Skip to content

Commit

Permalink
- [#] switch code gen from cli to go-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
suntong committed Jan 18, 2022
1 parent c611155 commit a1438c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 7 additions & 4 deletions cc2py_cli.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
# program name, name for the executable
ProgramName: cc2py
Authors: Tong Sun

PackageName: main

Name: cc2pyC
Desc: Chinese-Character to Pinyin converter
Text: Converter Chinese to pinyin in different ways
#NumArg: cli.AtLeast(1)
#NumOption: cli.AtLeast(3)
CanSubRoute: true

Options:
- Name: Filei
Type: '*clix.Reader'
Type: string
Flag: "i,in"
Usage: 'the Chinese text file to read from (or stdin)\n\t\t\tif not specified, read from command line instead'

- Name: Tone
Type: int
Flag: 't,tone'
EnvV: true
Usage: 'tone selection\n\t\t\t 0: normal. mnemonic~ nothing\n\t\t\t 1: tone at the end. mnemonic~ single sided\n\t\t\t 2: tone after yunmu. mnemonic~ double sided\n\t\t\t 3: tone on yunmu. mnemonic~ fancy'

- Name: Truncate
Type: int
Flag: 'l,truncate'
EnvV: true
Usage: 'select only part of the pinyin\n\t\t\t 0: normal. mnemonic~ nothing truncated\n\t\t\t 1: leave first char. mnemonic~ one\n\t\t\t 2: leave first shengmu. mnemonic~ might be two\n\t\t\t 9: leave only yunmu. mnemonic~ last'

- Name: Separator
Type: string
Flag: s,separator
EnvV: true
Usage: separator string between each pinyin
Value: " "

- Name: Polyphone
Type: bool
Flag: p,polyphone
EnvV: true
Usage: polyphone support, output each polyphone pinyin available

- Name: Capital
Type: bool
Flag: c,capitalized
EnvV: true
Usage: capitalized each pinyin word

4 changes: 3 additions & 1 deletion cc2py_cliGen.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
easygen -tf ../../suntong/cli/cli-tx cc2py | gofmt > cc2pyCLIDef.go
pwd=`pwd`
cd $GOPATH/src/github.com/go-easygen/easygen/test
easygen commandlineGoFlags.header,commandlineGoFlags.ityped.tmpl,commandlineGoFlags "$pwd/cc2py"_cli | gofmt > "$pwd/cc2py"_cliDef.go

0 comments on commit a1438c6

Please sign in to comment.