Skip to content

Commit a1438c6

Browse files
committed
- [#] switch code gen from cli to go-flags
1 parent c611155 commit a1438c6

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

cc2py_cli.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
# program name, name for the executable
22
ProgramName: cc2py
3+
Authors: Tong Sun
34

45
PackageName: main
56

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

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

1917
- Name: Tone
2018
Type: int
2119
Flag: 't,tone'
20+
EnvV: true
2221
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'
2322

2423
- Name: Truncate
2524
Type: int
2625
Flag: 'l,truncate'
26+
EnvV: true
2727
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'
2828

2929
- Name: Separator
3030
Type: string
3131
Flag: s,separator
32+
EnvV: true
3233
Usage: separator string between each pinyin
3334
Value: " "
3435

3536
- Name: Polyphone
3637
Type: bool
3738
Flag: p,polyphone
39+
EnvV: true
3840
Usage: polyphone support, output each polyphone pinyin available
3941

4042
- Name: Capital
4143
Type: bool
4244
Flag: c,capitalized
45+
EnvV: true
4346
Usage: capitalized each pinyin word
4447

cc2py_cliGen.sh

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

0 commit comments

Comments
 (0)