holmgr / cargo-sweep

A cargo subcommand for cleaning up unused build files generated by Cargo
MIT License
693 stars 31 forks source link

-t requires a <days> argument but the help says it has a default value #51

Closed mattico closed 1 year ago

mattico commented 3 years ago
$ cargo sweep --help
...
    -t, --time <days>                Number of days backwards to keep. If no value is set uses 30.
...
$ cargo sweep -t
error: The argument '--time <days>' requires a value but none was supplied

USAGE:
    cargo-sweep.exe sweep <--stamp|--file|--time <days>|--installed|--toolchains <toolchains>|--maxsize <maxsize>>

Also it appears that the --version flag doesn't work:

$ cargo sweep -V
cargo-sweep.exe-sweep
$ cargo sweep --version
cargo-sweep.exe-sweep
$ cargo sweep --version -v
cargo-sweep.exe-sweep

I installed with cargo install minutes ago so I have version 0.5.0.

CosmicHorrorDev commented 3 years ago

As for --time's help text I agree that it's strange since an argument is required and I didn't notice any logic regarding some fallback value either (the current approach .expect()s a time value along with .expect()ing it being a valid u64

As for the version flag being weird I have a tentative fix opened in #58 since cargo is currently invoking a subcommand that doesn't have a version (hinted by the extra -sweep)

marcospb19 commented 1 year ago

--version is working, and here's the --time wrong usage message:

$ cargo sweep -t
error: a value is required for '--time <TIME>' but none was supplied

And the help message.

$ cargo sweep --help
...
  -t, --time <TIME>
          Number of days backwards to keep

So this issue is solved (ping @jyn514).