Skip to content

Commit

Permalink
pref(cmd/uymas): test add dynamic option test.
Browse files Browse the repository at this point in the history
  • Loading branch information
conero committed Sep 28, 2023
1 parent 0606438 commit 8353e4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- feat: 新增中国传统的天干地支与年份的关系,实现年份的计算
- **cmd/uymas**
- pref: 优化默认命令并显示应用的名称
- pref: test 子命令添加动态参数获取
- feat: 新增命令 "digit/dg" 用于数字与中文大小写数字转换
- feat: 新增命令"hash"实现读取文件的hash,用于文件比较
- feat: 新增命令“ganz"实现年份的干支纪元法计算
Expand Down
2 changes: 0 additions & 2 deletions bin/arg.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ func NewCliCmd(args ...string) *Arg {
}

// NewCliCmdByString construction of `Arg` by string
//
// @todo notice: `--test-string="Joshua 存在空格的字符串 Conero"` 解析失败
func NewCliCmdByString(ss string) *Arg {
return NewCliCmd(butil.StringToArgs(ss)...)
}
Expand Down
9 changes: 9 additions & 0 deletions cmd/uymas/defaultApp.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,18 @@ func (c *defaultApp) Test() {
fmt.Printf(" NextLing : %#v \n", cc.NextList())
fmt.Printf(" Args : %#v \n", os.Args[1:])

// var
varName := cc.ArgRaw("var", "v")
if varName != "" {
fmt.Printf(" Var : %s => %s \n", varName, cc.ArgRaw(varName))
fmt.Printf(" Var/Raw : %s => %#v \n", varName, cc.Arg(varName))
}

fmt.Println()
fmt.Printf(" %v \n", getSpendStr())
fmt.Println()
fmt.Println()
fmt.Println("输入命令 “--var,-v $name” 可用于读取 $name 的option参数")
}

// Repl REPL
Expand Down

0 comments on commit 8353e4c

Please sign in to comment.