darakian / ddh

A fast duplicate file finder
Other
452 stars 18 forks source link

Clap 4 #61

Closed VysNouse closed 1 year ago

VysNouse commented 2 years ago

Always polishing the cli :) Now I've used the new shinny clap derive api.

Some minor changes: 1) directories is now a mandatory positional argument (no -d flag):

$ cargo run -- -f json  -o=no src
4 Total files (with duplicates): 24 Kilobytes
4 Total files (without duplicates): 24 Kilobytes
4 Single instance files: 24 Kilobytes
0 Shared instance files: 0 Kilobytes (0 instances)

$ cargo run -- -f json  -o=no 
error: The following required arguments were not provided:
  <DIRECTORIES>...

Usage: ddh --format [<FMT>] --output [<OUTPUT>] <DIRECTORIES>...

For more information try '--help'

2) ignore_dirs are a comma separated list (or you can repeat the -i flags):

$ cargo run -- -f json -i target/debug/.fingerprint/,target/debug -o=no .
156 Total files (with duplicates): 441 Kilobytes
150 Total files (without duplicates): 441 Kilobytes
145 Single instance files: 441 Kilobytes
5 Shared instance files: 0 Kilobytes (11 instances)

$ cargo run -- -f json -i target/debug/.fingerprint/ -i target/debug -o=no .
156 Total files (with duplicates): 441 Kilobytes
150 Total files (without duplicates): 441 Kilobytes
145 Single instance files: 441 Kilobytes
5 Shared instance files: 0 Kilobytes (11 instances)
darakian commented 2 years ago

Sorry for the delayed response. This looks great! Many thanks for switching over to the derive api too. I had that on my roadmap :)

The -d flag is something I added back when moving to clap 3 https://github.com/darakian/ddh/commit/5e14d491ea523e6e9f9462ffd436cea052bf560c and I think I prefer it to the implicit argument though.