Provide the length of Args when a -- is found in commandline

This allows a program to know what args came before the -- and what args
came after.
This commit is contained in:
Eric Paris
2015-09-16 12:31:41 -04:00
parent 4b76e97cd6
commit edde52e321
2 changed files with 12 additions and 2 deletions

View File

@ -470,6 +470,10 @@ func (c *Command) Root() *Command {
return findRoot(c)
}
func (c *Command) ArgsLenAtDash() int {
return c.Flags().ArgsLenAtDash()
}
func (c *Command) execute(a []string) (err error) {
if c == nil {
return fmt.Errorf("Called Execute() on a nil Command")