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.

4

1 回答 1

0

我有参数(arg)和选项(opt)倒退。他们应该是:

ls --tree /foo/bar

使用这个标准,scopt 已经用 arg 指令做到了这一点。

于 2017-04-26T16:12:54.897 回答