Skip to content

Commit 0345528

Browse files
committed
- [+] add verbose & version options wireframe
1 parent 241faeb commit 0345528

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

cc2py_cli.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PackageName: main
77
Name: cc2py
88
Desc: Chinese-Character to Pinyin converter
99
Text: Converter Chinese to pinyin in different ways
10+
Verbose: true
11+
Version: true
1012

1113
Options:
1214
- Name: Filei

cc2py_cliDef.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff 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

cc2py_opt.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)