Skip to content

Commit

Permalink
feat: add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzhiter committed May 27, 2024
1 parent c7b0132 commit 449c382
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 48 deletions.
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# **kitexcall**
# **kitexcall** (*This is a community driven project*)

English | [中文](README_cn.md)

Expand All @@ -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.
Expand All @@ -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
Expand All @@ -66,15 +46,15 @@ service Echo {
}
```

- JSON Format Request Data
- Creating a file input.json specifying JSON format request data:

```json
{
"message": "hello"
}
```

- Server
- Server:

```go
var _ api.Echo = &EchoImpl{}
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Use the `-verbose` or `-v` flag to enable verbose mode, providing more detailed output information.

---
Maintained by: [Zzhiter](https://github.com/Zzhiter)
53 changes: 31 additions & 22 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# kitexcall
# kitexcall (*这是一个社区驱动的项目*)

中文 | [English](README.md)

Expand Down Expand Up @@ -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
Expand All @@ -66,7 +46,7 @@ service Echo {
}
```

对应的 json 格式请求数据
创建input.json文件指定json格式请求数据

```python
{
Expand Down Expand Up @@ -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"
}
```

### 命令行选项

支持以下选项:
Expand Down Expand Up @@ -194,3 +200,6 @@ kitexcall -m ExampleMethod -biz-error
#### 启用详细模式

使用 `-verbose``-v` 标志启用详细模式,以提供更详细的输出信息。

---
维护者: [Zzhiter](https://github.com/Zzhiter)

0 comments on commit 449c382

Please sign in to comment.