-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4406ad6
commit f685aca
Showing
1 changed file
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,51 @@ | ||
# st2 | ||
`st2` is a converter between json, protobuf, thrift, go struct. | ||
[![test](https://github.com/tenfyzhong/st2/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/tenfyzhong/st2/actions/workflows/test.yml) | ||
[![Go Reference](https://pkg.go.dev/badge/github.com/tenfyzhong/st2.svg)](https://pkg.go.dev/github.com/tenfyzhong/st2) | ||
|
||
`st2` provide a package to parse json/protobuf/thrift/go/csv code and generage go/protobuf/thrift code. | ||
|
||
## Cli | ||
`st2` provide a terminal command line tool `st2`, which can be used to generate go/protobuf/thrift code from json/protobuf/thrift/go/csv code. | ||
|
||
### Install | ||
You can download the release of `st2` from the [GitHub releases](https://github.com/tenfyzhong/st2/releases). | ||
Or you can build it from source code. | ||
```bash | ||
go install github.com/tenfyzhong/st2/cmd/st2@latest | ||
``` | ||
|
||
### Usage | ||
``` | ||
NAME: | ||
st2 - convert between json, protobuf, thrift, go struct | ||
USAGE: | ||
st2 [global options] [arguments...] | ||
VERSION: | ||
developing | ||
AUTHOR: | ||
tenfyzhong <[email protected]> | ||
GLOBAL OPTIONS: | ||
common | ||
--root name, -r name The root struct name (default: Root) | ||
input | ||
--input file, -i file Input file, if not set, it will read from stdio | ||
--rc Read input from clipboard (default: false) | ||
--src type, -s type The source data type, it will use the suffix of the input file if not set, available value: `[json,proto,thrift,go,csv]` | ||
output | ||
--dst type, -d type The destination data type, it will use the suffix of the output file if not set, available value: `[go,proto,thrift]` | ||
--output file, -o file Output file, if not set, it will write to stdout | ||
--wc Write output to clipboard (default: false) | ||
COPYRIGHT: | ||
Copyright (c) 2022 tenfy | ||
``` |