Skip to content

Commit

Permalink
Update clap to 4.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ssokolow committed Nov 4, 2023
1 parent 46cc21f commit 996669b
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 115 deletions.
236 changes: 126 additions & 110 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "3", features = ["derive"] }
clap = { version = "4.4.7", features = ["derive"] }
walkdir = "2.4.0"

[features]
19 changes: 15 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,33 @@ use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};

use clap::Parser;
use clap::{
builder::styling::{AnsiColor, Styles},
Parser,
};
use walkdir::WalkDir;

fn styles() -> Styles {
Styles::styled()
.header(AnsiColor::Yellow.on_default())
.usage(AnsiColor::Yellow.on_default())
.literal(AnsiColor::Green.on_default())
.placeholder(AnsiColor::Green.on_default())
}

/// Command-line argument schema
#[derive(Debug, Parser)]
#[clap(version, about = "Rename files and directories to fit length limits.\n\nWARNING: Will not preserve secondary extensions like .tar.gz", long_about = None)]
#[command(version, about = "Rename files and directories to fit length limits.\n\nWARNING: Will not preserve secondary extensions like .tar.gz", long_about = None, styles = styles())]
struct CliArgs {
/// Paths to rename (recursively, if directories)
path: Vec<PathBuf>,

/// Length to truncate to. (Default chosen for rclone name encryption)
#[clap(long, default_value_t = 140)]
#[arg(long, default_value_t = 140)]
max_len: usize,

/// Don't actually rename files. Just print.
#[clap(short = 'n', long, action, default_value_t = false)]
#[arg(short = 'n', long, action, default_value_t = false)]
dry_run: bool,
}

Expand Down

0 comments on commit 996669b

Please sign in to comment.