Skip to content

Commit 2486c0c

Browse files
committed
Fix bruh mistake
1 parent 06453ff commit 2486c0c

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-clean-all"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
authors = ["Daniel M <danielm-github@dnml.de>"]
55
license = "MIT"
66
repository = "https://github.com/dnlmlr/cargo-clean-all"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cargo clean-all
3535

3636
Clean all target directories under the directory `[dir]`.
3737
```
38-
cargo clean-all --dir [dir]
38+
cargo clean-all [dir]
3939
```
4040

4141
Keep target directories that have a size of less than `[filesize]`.

src/main.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use std::{
88
};
99

1010
#[derive(Debug, Parser)]
11-
#[clap(author, version, about, long_about = None)]
11+
#[clap(author, version, about, bin_name = "cargo clean-all", long_about = None)]
1212
struct AppArgs {
1313
/// The directory that will be cleaned
14-
#[clap(short = 'r', long = "dir", default_value_t = String::from("."), value_name = "DIR")]
14+
#[clap(default_value_t = String::from("."), value_name = "DIR")]
1515
root_dir: String,
1616

1717
/// Don't ask for confirmation
@@ -52,7 +52,15 @@ struct AppArgs {
5252
}
5353

5454
fn main() {
55-
let args = AppArgs::parse();
55+
let mut args = std::env::args();
56+
57+
// When called using `cargo clean-all`, the argument `clean-all` is inserted. To fix the arg
58+
// alignment, one argument is dropped.
59+
if let Some("clean-all") = std::env::args().skip(1).next().as_deref() {
60+
args.next();
61+
}
62+
63+
let args = AppArgs::parse_from(args);
5664

5765
let scan_path = Path::new(&args.root_dir);
5866

0 commit comments

Comments
 (0)