Skip to content

Use subcommand for arguments to command being run

Update to the version 0.3 of Structopt with optional subcommand support. This allows passing in arguments to the command being run by strace.

https://docs.rs/structopt/0.3.21/structopt/index.html#optional-subcommands

The use case is this:

strace ls -r

Will not reverse the output of ls, instead strace will be run with the -r (recursive) argument.

Also, this will not work:

strace ls -l

Because -l is not a valid argument to strace.

The optional subcommand stuff in Structopt is apparently fairly smart. It seems like the first thing that isn't a valid argument to the main program (in this case, strace) is then made an optional subcommand, and everything after that is passed as arguments to that optional subcommand.

Merge request reports