Skip to main content

check_updates_cli/
cli.rs

1use clap::{Parser, builder::styling};
2
3const STYLES: clap::builder::Styles = styling::Styles::styled()
4    .header(styling::AnsiColor::Yellow.on_default().bold())
5    .usage(styling::AnsiColor::Green.on_default().bold())
6    .literal(styling::AnsiColor::Blue.on_default().bold())
7    .placeholder(styling::AnsiColor::Green.on_default());
8
9#[derive(Parser, Debug)]
10#[command(
11    name = "check-updates",
12    about = "Check for updates in your dependencies",
13    version,
14    styles(STYLES)
15)]
16pub struct Args {
17    #[arg(short, long, help = "Interactive mode")]
18    pub interactive: bool,
19
20    #[arg(long, help = "Root directory to search from", value_name = "DIR")]
21    pub root: Option<std::path::PathBuf>,
22
23    #[arg(long, help = "Enable verbose output")]
24    pub verbose: bool,
25
26    #[arg(short = 'u', long, help = "Upgrade version requirements in Cargo.toml")]
27    pub upgrade: bool,
28
29    #[arg(
30        short = 'U',
31        long = "update",
32        help = "Upgrade requirements and run cargo update",
33        conflicts_with = "upgrade"
34    )]
35    pub update: bool,
36
37    #[arg(long, help = "Only upgrade to semver-compatible versions")]
38    pub compatible: bool,
39
40    #[arg(long, help = "Compact interactive mode (fewer spacing lines)")]
41    pub compact: bool,
42
43    #[arg(long, help = "Include pre-release/alpha/beta versions")]
44    pub pre: bool,
45
46    #[arg(
47        short,
48        long,
49        help = "Only check specific packages (can be specified multiple times)"
50    )]
51    pub package: Vec<String>,
52}
53
54// TODO
55// #[arg(
56//     long,
57//     help = "Ignore minimum rust version when checking compatible versions"
58// )]
59// pub ignore_rust_version: bool,