Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update readme #181

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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:

Expand All @@ -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.
42 changes: 42 additions & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -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 解析器生成额外的代码。有关更多信息,请查阅插件包的文档。
Loading