Implement cloning of commands

This commit is contained in:
Kovid Goyal
2022-09-20 20:44:16 +05:30
parent bc38bd75fd
commit 1811949706
2 changed files with 86 additions and 20 deletions

View File

@@ -36,7 +36,7 @@ func (self *Command) parse_args(ctx *Context, args []string) error {
return nil
}
for len(self.args) > 0 {
for len(self.Args) > 0 {
arg := consume_arg()
if expecting_arg_for == nil {
@@ -67,7 +67,7 @@ func (self *Command) parse_args(ctx *Context, args []string) error {
}
} else {
// handle non option arg
if self.AllowOptionsAfterArgs <= len(self.args) {
if self.AllowOptionsAfterArgs <= len(self.Args) {
options_allowed = false
}
if self.HasSubCommands() {
@@ -80,7 +80,7 @@ func (self *Command) parse_args(ctx *Context, args []string) error {
return sc.parse_args(ctx, args_to_parse)
}
}
self.args = append(self.args, arg)
self.Args = append(self.Args, arg)
}
} else {
// handle option value