Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#+title: GRPClient

[[https://melpa.org/#/grpclient][file:https://melpa.org/packages/grpclient-badge.svg]]

[[https://github.com/fullstorydev/grpcurl][gRPCurl]] query builder from plain-text sheets havily inspired by [[https://github.com/pashky/restclient.el][restclient.el]]

* Install by Melpa
Ensure that you have melpa in your ~package-archives~ varaible.

Evaluate ~M-x package-install RET grpclient~ or add following configuration in your ~init.el~ or ~.emacs~ file
#+begin_src emacs-lisp
(use-package grpclient
  :ensure t
  :init
  (add-to-list 'auto-mode-alist '("\\.grpc\\'" . grpclient-mode)))
#+end_src
* Install manually
1. Install [[https://github.com/fullstorydev/grpcurl][gRPCurl]]
2. Clone repository to your local directory
3. Add following configuration in your ~init.el~ or ~.emacs~ file
#+begin_src emacs-lisp
(use-package grpclient
  :ensure nil
  :load-path "~/path/to/grpclient.el/"
  :init
  (add-to-list 'auto-mode-alist '("\\.grpc\\'" . grpclient-mode)))
#+end_src
4. Check [[file:examples/bins.grpc][example file]]

* Quick Insert (gRPC Reflection)
Insert complete gRPC requests using server reflection.  Uses
standard ~completing-read~ (works with consult, vertico, icomplete, fido, ido, helm, ivy).

Call ~grpclient-completion-complete~ (~C-c C-c~ in ~grpclient-mode~) or ~M-x~.
It prompts for a server address and method name, then inserts:
#+begin_example
# Call SayHello
GRPC grpcb.in:9000 hello.HelloService/SayHello
{<message template>}
#+end_example

| Command                              | Binding     | Description                   |
|--------------------------------------+-------------+-------------------------------|
| ~grpclient-completion-complete~      | ~C-c C-c~   | Insert gRPC request at point  |
| ~grpclient-completion-refresh-cache~ | ~M-x <cmd>~ | Force-refetch reflection data |
* Running the Example gRPC Server
To test the Emacs mode, you can start a local Python gRPC server serving both Proto2 and Proto3 examples.

The easiest way to start the server is to use the provided shell script. It will automatically create a virtual environment, install dependencies, compile the Protocol Buffers, and start the server.

#+begin_src bash
./examples/start_server.sh
#+end_src

The server will start on port =9000= with gRPC reflection enabled, making it easy to query using =grpcurl= and =grpclient-mode=.

* Key-map
| kdb     | function                            |
|---------+-------------------------------------|
| C-c C-v | grpclient-send-current              |
| C-c C-u | grpclient-copy-grpcurl-to-clipboard |
| C-c C-l | grpclient-describe                  |
| C-c C-c | grpclient-completion-complete       |
| <tab>   | grpclient-toggle-pretty-body        |

* Screenshot
[[file:examples/grpclient-el.png]]
* Demo
[[file:examples/grpclient-el.gif]]

About

gRPC client for Emacs based on beautiful grpcurl

Resources

Stars

13 stars

Watchers

1 watching

Forks

Contributors

Languages