ZhangZhihui's Blog  

 

zzh@ZZHPC:~$ evans --help
evans 0.10.11

Usage: evans [global options ...] <command>

Options:
        --silent, -s                     hide redundant output (default "false")
        --path strings                   comma-separated proto file paths (default "[]")
        --proto strings                  comma-separated proto file names (default "[]")
        --host string                    gRPC server host
        --port, -p string                gRPC server port (default "50051")
        --header slice of strings        default headers that set to each requests (example: foo=bar) (default "[]")
        --web                            use gRPC-Web protocol (default "false")
        --reflection, -r                 use gRPC reflection (default "false")
        --tls, -t                        use a secure TLS connection (default "false")
        --cacert string                  the CA certificate file for verifying the server
        --cert string                    the certificate file for mutual TLS auth. it must be provided with --certkey.
        --certkey string                 the private key file for mutual TLS auth. it must be provided with --cert.
        --servername string              override the server name used to verify the hostname (ignored if --tls is disabled)
        --edit, -e                       edit the project config file by using $EDITOR (default "false")
        --edit-global                    edit the global config file by using $EDITOR (default "false")
        --verbose                        verbose output (default "false")
        --version, -v                    display version and exit (default "false")
        --help, -h                       display help text and exit (default "false")

Available Commands:
        cli         CLI mode
        repl        REPL mode

read–eval–print loop (REPL), also termed an interactive toplevel or language shell.

 

zzh@ZZHPC:~$ evans cli
evans 0.10.11

Usage: evans [global options ...] cli

Options:
        --help, -h        display help text and exit (default "false")

Available Commands:
        call, c               call a method
        desc, describe        describe the descriptor of a symbol
        list, ls, show        list services or methods

evans: invalid config condition: 1 error occurred:

* one or more proto files, or gRPC reflection required
zzh@ZZHPC:~$ evans cli list
evans 0.10.11

Usage: evans [global options ...] cli list [options ...] [fully-qualified service/method name]

list provides listing feature against to gRPC services or methods belong to a service.
If a fully-qualified service name (in the form of <package name>.<service name>),
list lists method names belong to the service. If not, list lists all services.

Examples:
        $ evans -r cli list             # list all services
        $ evans -r cli list -o json     # list all services with JSON format
        $ evans -r cli list api.Service # list all methods belong to service "api.Service"

Options:
        --output, -o string        output format. one of "json" or "name". (default "name")
        --help, -h                 display help text and exit (default "false")

evans: invalid config condition: 1 error occurred:

* one or more proto files, or gRPC reflection required
zzh@ZZHPC:~$ evans --port 9090 -r cli list
grpc.reflection.v1.ServerReflection
grpc.reflection.v1alpha.ServerReflection
pb.ZimpleBank

The cli mode can list the services.

 

The repl mode works well too:

zzh@ZZHPC:~$ which evans
/home/zzh/Downloads/sfw/evans
zzh@ZZHPC:~$ evans --port 9090 -r repl

  ______
 |  ____|
 | |__    __   __   __ _   _ __    ___
 |  __|   \ \ / /  / _. | | '_ \  / __|
 | |____   \ V /  | (_| | | | | | \__ \
 |______|   \_/    \__,_| |_| |_| |___/

 more expressive universal gRPC client


127.0.0.1:9090> show package
+-------------------------+
|         PACKAGE         |
+-------------------------+
| grpc.reflection.v1      |
| grpc.reflection.v1alpha |
| pb                      |
+-------------------------+

127.0.0.1:9090> package pb

pb@127.0.0.1:9090> show service
+------------+------------+-------------------+--------------------+
|  SERVICE   |    RPC     |   REQUEST TYPE    |   RESPONSE TYPE    |
+------------+------------+-------------------+--------------------+
| ZimpleBank | CreateUser | CreateUserRequest | CreateUserResponse |
| ZimpleBank | LoginUser  | LoginUserRequest  | LoginUserResponse  |
+------------+------------+-------------------+--------------------+

pb@127.0.0.1:9090> show message
+--------------------+
|      MESSAGE       |
+--------------------+
| CreateUserRequest  |
| CreateUserResponse |
| LoginUserRequest   |
| LoginUserResponse  |
+--------------------+

pb@127.0.0.1:9090> service ZimpleBank

pb.ZimpleBank@127.0.0.1:9090> call CreateUser
username (TYPE_STRING) => alice
full_name (TYPE_STRING) => Alice
email (TYPE_STRING) => alice@example.com
password (TYPE_STRING) => alice123

 

posted on 2023-12-23 20:15  ZhangZhihuiAAA  阅读(14)  评论(0编辑  收藏  举报