diff --git a/README.md b/README.md index 23fb297..d587b6c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# **kitexcall** +# **kitexcall** (*This is a community driven project*) English | [中文](README_cn.md) @@ -9,7 +9,7 @@ Kitexcall is a command-line tool for sending JSON general requests using kitex, - **Supports Thrift/Protobuf:** It supports IDL in Thrift/Protobuf formats. - **Supports Multiple Transport Protocols:** It supports transport protocols like Buffered, TTHeader, Framed, and TTHeaderFramed, with plans to support GRPC (Protobuf and Thrift Streaming) in the future. - **Supports Common Client Options:** It allows specify common client options, such as client.WithHostPorts, etc. -- **Supports manual data input from the command line and local files: **Request data can be read from command line arguments or local files. +- **Supports manual data input from the command line and local files:** Request data can be read from command line arguments or local files. - **Supports Metadata Passing:** It supports sending transient keys (WithValue) and persistent keys (WithPersistentValue), and also supports receiving backward metadata (Backward) returned by the server. - **Supports Receiving Business Custom Exceptions:** It can receive business custom exception error codes, error messages, and additional information. - **Supports Multiple Output Formats:** By default, it outputs a human-friendly readable format, and plans to support parseable formats for better integration with other automation tools. @@ -26,27 +26,7 @@ go install github.com/kitex-contrib/kitexcall@latest When using the kitexcall tool, you need to specify several required arguments, including the path to the IDL file, the method name, and the data to be sent. Example: -- Directly specifying request data: - -```bash -kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 -[Status]: Success -{ - "message": "hello" -} -``` - -- Or reading request data from a file: - -```bash -kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 -f input.json -[Status]: Success -{ - "message": "hello" -} -``` - -- IDL File: +- IDL file: ```thrift // echo.thrift @@ -66,7 +46,7 @@ service Echo { } ``` -- JSON Format Request Data +- Creating a file input.json specifying JSON format request data: ```json { @@ -74,7 +54,7 @@ service Echo { } ``` -- Server +- Server: ```go var _ api.Echo = &EchoImpl{} @@ -98,6 +78,32 @@ func main() { } ``` +- Directly specifying request data: + +```bash +kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 +``` +Output: +``` +[Status]: Success +{ + "message": "hello" +} +``` + +- Or reading request data from a file: + +```bash +kitexcall -idl-path echo.thrift -m echo -e 127.0.0.1:9999 -f input.json +``` +Output: +``` +[Status]: Success +{ + "message": "hello" +} +``` + ### Command Line Options - `-help` or `-h`: Outputs the usage instructions. @@ -191,4 +197,7 @@ kitexcall -m ExampleMethod -biz-error #### Enable Verbose Mode -Use the `-verbose` or `-v` flag to enable verbose mode, providing more detailed output information. \ No newline at end of file +Use the `-verbose` or `-v` flag to enable verbose mode, providing more detailed output information. + +--- +Maintained by: [Zzhiter](https://github.com/Zzhiter) \ No newline at end of file diff --git a/README_cn.md b/README_cn.md index d611a0b..f8bc87a 100644 --- a/README_cn.md +++ b/README_cn.md @@ -1,4 +1,4 @@ -# kitexcall +# kitexcall (*这是一个社区驱动的项目*) 中文 | [English](README.md) @@ -26,26 +26,6 @@ go install github.com/kitex-contrib/kitexcall@latest 使用 `kitexcall` 工具时,需要指定多个必选参数,包括 IDL 文件的路径、方法名以及要发送的数据。示例: -- 直接指定请求数据: - -```bash -kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 -[Status]: Success -{ - "message": "hello" -} -``` - -- 从文件读入请求数据: - -```bash -kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 -f input.json -[Status]: Success -{ - "message": "hello" -} -``` - 对应的 IDL 文件: ```python @@ -66,7 +46,7 @@ service Echo { } ``` -对应的 json 格式请求数据: +创建input.json文件指定json格式请求数据: ```python { @@ -98,6 +78,32 @@ func main() { } ``` +- 直接指定请求数据: + +```bash +kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 +``` +输出: +``` +[Status]: Success +{ + "message": "hello" +} +``` + +- 从文件读入请求数据: + +```bash +kitexcall -idl-path echo.thrift -m echo -d '{"message": "hello"}' -e 127.0.0.1:9999 -f input.json +``` +输出: +``` +[Status]: Success +{ + "message": "hello" +} +``` + ### 命令行选项 支持以下选项: @@ -194,3 +200,6 @@ kitexcall -m ExampleMethod -biz-error #### 启用详细模式 使用 `-verbose` 或 `-v` 标志启用详细模式,以提供更详细的输出信息。 + +--- +维护者: [Zzhiter](https://github.com/Zzhiter) \ No newline at end of file