holmgr / cargo-sweep

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

Installed, maxsize, and toolchains flags can't be used #54

Closed Lynnesbian closed 3 years ago

Lynnesbian commented 3 years ago

When running cargo sweep -i:

thread 'main' panicked at '--time argument missing', /home/lynne/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-sweep-0.6.1/src/main.rs:232:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

When running cargo sweep -i -t 30:

error: The argument '--installed' cannot be used with one or more of the other specified arguments

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

For more information try --help

It seems as though the issue is that the time argument is expect()ed here: https://github.com/holmgr/cargo-sweep/blob/932a08a184809144379ced4c833a28464df8b88b/src/main.rs#L226-L236

...even though the --installed flag never uses the value of keep_duration (and therefore it shouldn't be expect()ed): https://github.com/holmgr/cargo-sweep/blob/932a08a184809144379ced4c833a28464df8b88b/src/main.rs#L253-L265

This issue also occurs with the --toolchains flag and --maxsize flags.