0

I'm using scopt to process command line arguments and would like to accept a blind/unlabeled argument. Let's take a super-simplified, familiar 'ls' command as an example:

ls [<selector>] [options]

where options is just one: --tree

So examples of use could be:

ls
ls --tree
ls . --tree
ls /foo/bar
ls /foo/bar --tree

The scopt library can handle the options easily and has something defined as a command (i.e. if ls had some kind of secondary mode), but I don't see how i can accept an optional string (the selector) w/o a preceding option label.

Greg
  • 10,696
  • 22
  • 68
  • 98

1 Answers1

0

I had arguments (arg) and options (opt) backwards. They should be:

ls --tree /foo/bar

Using this standard, scopt already does this with the arg directive.

Greg
  • 10,696
  • 22
  • 68
  • 98