File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ PackageName: main
77Name : cc2py
88Desc : Chinese-Character to Pinyin converter
99Text : Converter Chinese to pinyin in different ways
10+ Verbose : true
11+ Version : true
1012
1113Options :
1214 - Name : Filei
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import (
2424// var (
2525// progname = "cc2py"
2626// version = "0.1.0"
27- // date = "2022-01-18 "
27+ // date = "2022-01-22 "
2828
2929// // Opts store all the configurable options
3030// Opts OptsT
@@ -37,6 +37,10 @@ import (
3737
3838// Function main
3939// func main() {
40+ // Opts.Version = showVersion
41+ // Opts.Verbflg = func() {
42+ // Opts.Verbose++
43+ // }
4044//
4145// if _, err := parser.Parse(); err != nil {
4246// fmt.Println()
@@ -46,6 +50,14 @@ import (
4650// fmt.Println()
4751// //DoCc2py()
4852// }
53+ //
54+ // func showVersion() {
55+ // fmt.Fprintf(os.Stderr, "cc2py - Chinese-Character to Pinyin converter\n")
56+ // fmt.Fprintf(os.Stderr, "Copyright (C) 2022, Tong Sun\n\n")
57+ // fmt.Fprintf(os.Stderr, "Converter Chinese to pinyin in different ways\n\nBuilt on %s\nVersion %s\n",
58+ // date, version)
59+ // os.Exit(0)
60+ // }
4961// Template for main ends here
5062
5163// DoCc2py implements the business logic of command `cc2py`
@@ -70,5 +82,8 @@ import (
7082// Args struct {
7183// CCStrs []string
7284// } `positional-args:"yes" required:"yes"`
85+ // Verbflg func() `short:"v" long:"verbose" description:"Verbose mode (Multiple -v options increase the verbosity)"`
86+ // Verbose int
87+ // Version func() `short:"V" long:"version" description:"Show program version and exit"`
7388// }
7489// Template for type define ends here
Original file line number Diff line number Diff line change @@ -22,4 +22,7 @@ type OptsT struct {
2222 Args struct {
2323 CCStrs []string
2424 } `positional-args:"yes" required:"yes"`
25+ Verbflg func () `short:"v" long:"verbose" description:"Verbose mode (Multiple -v options increase the verbosity)"`
26+ Verbose int
27+ Version func () `short:"V" long:"version" description:"Show program version and exit"`
2528}
You can’t perform that action at this time.
0 commit comments