darakian/ddh

Incorrect help output

Tobi823 opened this issue ยท 6 comments

ddh --help reports:

USAGE:
    ddh [OPTIONS] <Directories>...

but it should be ddh <Directories>... [OPTIONS].

Sadly I don't know clap and how to fix it.

Thanks for the bug report. That's definitely an issue, but I'm not sure what I can do aside from making all inputs position independent which then changes the cli usage. That would require the use of -d/--directories and that will interfere with anyone's scripting.

That said, I do plan to change the cli interface at some point and I would appreciate any input :)

I have expressed myself ambiguously - the CLI works fine and it should not be changed. But the documentation (ddh --help and ddh) is wrong:

According to the documentation, I can do this: ddh -o no Downloads/. But this doesn't work:

error: The following required arguments were not provided:
    <Directories>...

USAGE:
    ddh <Directories>... --output <Output>

For more information try --help

I have to swap -o no and Downloads/. ddh Downloads/ -o no returns the correct output:

152 Total files (with duplicates): 94 Megabytes
141 Total files (without duplicates): 90 Megabytes
134 Single instance files: 86 Megabytes
7 Shared instance files: 3 Megabytes (18 instances)

This is no problem for experienced developers but maybe for beginners.

I understand the issue and you're right that is a bug. However the issue stems from my args declarations

.arg(Arg::with_name("directories")
...
                               .index(1))
                        .arg(Arg::with_name("Blocksize")
...

Short of changing my CLI interface I'm not sure there's anything I can do to fix this.

I'm closing this issue because:

  • I don't have to time to look deeper into "clap" to fix it (but maybe later?)
  • this bug is not critical, just a little bit annoying

Beside this little annoyance - the tool works and is very helpful. Thanks ๐Ÿ‘