becheran/mlc

Directory parameter is ignored if provided after an option

Closed this issue · 5 comments

Describe the bug
Unlike what is described in the --help, the directory parameter, at least in the following specific case, seems to be ignored when provided after an option.

To Reproduce
The following command reports broken links that are in <workdir>, rather than just <workdir>/<myfolder>:

mlc -i '<mylinktoignore>' <myfolder>

This one works as expected (only broken links from <workdir>/<myfolder>):

mlc <myfolder> -i '<mylinktoignore>'

Expected behavior
Syntax indicated by:

mlc --help
...
USAGE:
    mlc [FLAGS] [OPTIONS] [directory]
...

should work.

Thx for reporting. I will have a look once I find the time.

@diegorondini not sure if I am able to fix this. The underlying library for cli parsing clap interpretes your the in your first example as part of the -i arg. If you would write:

mlc -i='<mylinktoignore>' <myfolder>

it should work as expected. It is an issue of the parser not knowing that is not part of the ignore flag.

Ok, I'll look if there's an open issue in clap or open a new one and post the link here.

@diegorondini seems like it is my fault. The I used the clap option min_values instead takes_value which would have been right. I changes that and upgraded to the latest clap version in mlc. Will publish a new version including the fix soon.

Thanks for fixing!