climc: trim angle brackets for required options

This commit is contained in:
Yousong Zhou
2018-09-10 16:08:21 +00:00
parent 75f38447fd
commit 2325aa7ad0
+8 -7
View File
@@ -76,15 +76,16 @@ func getSubcommandsParser() (*structarg.ArgumentParser, error) {
cmd := v.Command
for _, v := range _par.GetOptArgs() {
_name := strings.Replace(v.String(), "]", "", -1)
_name = strings.Replace(_name, "[", "", -1)
promputils.AppendOpt(cmd, _name, v.HelpString(""))
text := v.String()
text = strings.TrimLeft(text, "[<")
text = strings.TrimRight(text, "]>")
promputils.AppendOpt(cmd, text, v.HelpString(""))
}
for _, v := range _par.GetPosArgs() {
_name := strings.Replace(v.String(), "<", "", -1)
_name = strings.Replace(_name, ">", "", -1)
promputils.AppendPos(cmd, _name, v.HelpString(""))
text := v.String()
text = strings.TrimLeft(text, "[<")
text = strings.TrimRight(text, "]>")
promputils.AppendPos(cmd, text, v.HelpString(""))
}
}
return parse, nil