Skip to content

Commit

Permalink
refactor: refactoring the flags shorts add and help render logic
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jul 5, 2022
1 parent 7afe8aa commit 623e065
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 173 deletions.
3 changes: 2 additions & 1 deletion gargs.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (ags *Arguments) ParseArgs(args []string) (err error) {
*************************************************************/

// AddArg binding an named argument for the command.
//
// Notice:
// - Required argument cannot be defined after optional argument
// - Only one array parameter is allowed
Expand All @@ -111,7 +112,7 @@ func (ags *Arguments) AddArg(name, desc string, requiredAndArrayed ...bool) *Arg
func (ags *Arguments) AddArgByRule(name, rule string) *Argument {
mp := parseSimpleRule(name, rule)

required := strutil.MustBool(mp["required"])
required := strutil.QuietBool(mp["required"])
newArg := NewArgument(name, mp["desc"], required)

if defVal := mp["default"]; defVal != "" {
Expand Down
Loading

0 comments on commit 623e065

Please sign in to comment.