fw icon indicating copy to clipboard operation
fw copied to clipboard

Confusing doc / error

Open chevdor opened this issue 3 years ago • 6 comments

fw add --help                                                          
fw-add 
Add project to config

USAGE:
    fw add [OPTIONS] <URL> [--] [NAME]

...

then:

fw add -t rust [email protected]:chevdor/fw.git
error: The following required arguments were not provided:
    <URL>

USAGE:
    fw add <URL> --tag <tag>...

The 2 doc don't agree with each other.

chevdor avatar Jul 02 '21 13:07 chevdor

I stumbled on this a while ago. https://github.com/brocode/fw/blob/master/src/app/mod.rs#L164 the issue is probably the index here. I didn't have the time to analyze this further.

bomgar avatar Jul 02 '21 13:07 bomgar

No stress, I may look into this eventually, I noticed that following the doc did not behave as intended. I guess something changed and the doc was not updated.

chevdor avatar Jul 02 '21 13:07 chevdor

So the right syntax as currently implemented is:

fw add <URL> [NAME] [-t ... ]  

The usage fw add [OPTIONS] <URL> [--] [NAME] is wrong.

chevdor avatar Jul 02 '21 17:07 chevdor

The library generates the help and the parser. So either we are doing something wrong using it or the lib has bug.

bomgar avatar Jul 02 '21 18:07 bomgar

I will have a look, I just wanted to document what I briefly checked to at least know how it works as I ended up with git urls as tags 😄

chevdor avatar Jul 02 '21 18:07 chevdor

I had a look and I think the code as it is is OK. clap gets lots if the options such as -t rust are provided before the URL. It would be interesting to see whether clap 3 handles this better.

chevdor avatar Jul 19 '21 09:07 chevdor