diff --git a/README.md b/README.md index 1f95c3fb..0a8dac9b 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ +# Thriftgo -thriftgo -======== +English | [中文](README_cn.md) **Thriftgo** is an implementation of [thrift](https://thrift.apache.org/docs/idl) compiler in go language. It has a command line interface similar to the apache/thrift compiler and is enhanced with a plugin mechanism which makes it more powerful. -Installation ------------- +## Installation Note: before executing the following commands, **make sure your `GOPATH` environment is properly set**. Using `go install`: -`GO111MODULE=on go install github.com/cloudwego/thriftgo` +`GO111MODULE=on go install github.com/cloudwego/thriftgo@latest` Or build from source: @@ -24,12 +23,11 @@ go build go install ``` -Usage ------ +## Usage -The thriftgo command line tool accepts IDL files and compiles them to the target language. Each backend has a plentiful set of options to customize the generated code. +The Thriftgo command line tool accepts IDL files and compiles them to the target language. Each backend has a plentiful set of options to customize the generated code. -By the moment, thriftgo can generates golang code only. More backends will be added in the future. +By the moment, Thriftgo can generates golang code only. More backends will be added in the future. To compile an thrift IDL to golang files with the default setting, you can just run: @@ -39,9 +37,6 @@ thriftgo -g go the-idl-file.thrift Run `thriftgo -h` to see all available options for each backend and their meanings. +## Plugin -Plugin ------- - -If the code generated by thriftgo does not satisfy your needs and the options provideds do not meet your requirements. You may also write plugins to generate code beside thriftgo while taking the advantage of thriftgo's IDL parser. Check the documentation of the plugin package for more details. - +If the code generated by Thriftgo does not satisfy your needs and the options provideds do not meet your requirements. You may also write plugins to generate code beside Thriftgo while taking the advantage of Thriftgo's IDL parser. Check the documentation of the plugin package for more details. diff --git a/README_cn.md b/README_cn.md new file mode 100644 index 00000000..a8cf1b50 --- /dev/null +++ b/README_cn.md @@ -0,0 +1,42 @@ +# Thriftgo + +[English](README.md) | 中文 + +**Thriftgo** 是 go 语言实现的 thrift 编译器。它具有与 apache/thrift 编译器类似的命令行界面,并通过插件机制增强了功能,使其更加强大。 + +## 安装 + +注意:在执行以下命令之前,请**确保**您的 `GOPATH` 环境已正确配置。 + +使用 `go install`: + +`GO111MODULE=on go install github.com/cloudwego/thriftgo@latest` + +或从源代码构建: + +```shell +git clone https://github.com/cloudwego/thriftgo.git +cd thriftgo +export GO111MODULE=on +go mod tidy +go build +go install +``` + +## 使用 + +Thriftgo 命令行工具接受 IDL 文件作为输入,并将其编译为目标语言。每个后端都有一系列丰富的选项,用于定制生成的代码。 + +Thriftgo 目前只能生成 golang 代码。将来还会添加更多后端。 + +要使用默认配置将 thrift IDL 编译为 golang 文件,只需运行: + +```shell +thriftgo -g go the-idl-file.thrift +``` + +运行 `thriftgo -h` 查看每个后端的所有可用选项及其含义。 + +## 插件 + +如果 Thriftgo 生成的代码不能满足您的需求,且提供的选项无法满足您的要求,您可以编写插件来利用 Thriftgo 的 IDL 解析器生成额外的代码。有关更多信息,请查阅插件包的文档。