Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

st2

go codecov GitHub tag Go Reference

st2 provide a package to parse json/yaml/protobuf/thrift/go/csv/xml/toml 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/yaml/protobuf/thrift/go/csv code.

Install

Use home brew

brew tap tenfyzhong/tap
brew install st2

Download from release

You can download the release of st2 from the GitHub releases.

build from source

go install github.com/tenfyzhong/st2/cmd/st2@latest

Usage

NAME:
   st2 - convert between json, yaml, protobuf, thrift, go struct

USAGE:
   st2 [global options] [arguments...]

VERSION:
   developing

AUTHOR:
   tenfyzhong

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

   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,yaml,proto,thrift,go,csv,xml,toml]`
   --xml-attribute-tag-prefix prefix  Add prefix to xml attribute tag in go field, only works for xml source and go destination (default: ,)
   --xml-content-tag-prefix prefix    Add prefix to xml content tag in go field, only works for xml source and go destination

   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
   --prefix prefix         Add prefix to struct name
   --suffix suffix         Add suffix to struct name
   --wc                    Write output to clipboard (default: false)


COPYRIGHT:
   Copyright (c) 2022 tenfy

About

`st2` generate go/protobuf/thrift code from json/yaml/protobuf/thrift/go/csv code

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages