Get fetches the remaining arguments after CLI parsing and splits them into two groups: the arguments before the double dash (--) and the arguments after the double dash.
()
| 14 | // two groups: the arguments before the double dash (--) and the arguments after |
| 15 | // the double dash. |
| 16 | func Get() ([]string, []string, error) { |
| 17 | args := pflag.Args() |
| 18 | doubleDashPos := pflag.CommandLine.ArgsLenAtDash() |
| 19 | |
| 20 | if doubleDashPos == -1 { |
| 21 | return args, nil, nil |
| 22 | } |
| 23 | return args[:doubleDashPos], args[doubleDashPos:], nil |
| 24 | } |
| 25 | |
| 26 | // Parse parses command line argument: tasks and global variables |
| 27 | func Parse(args ...string) ([]*task.Call, *ast.Vars) { |