use crate::dependency::Dependency;
#[derive(clap::Parser, Debug, Clone)]
#[command(author, version, about, long_about)]
pub struct Cli {
#[arg(long_help(
"Each dependency is:
- A NAME from crates.io
- A git URL (http/https/ssh)
- A local PATH (./, ../, /, or X:\\ prefix).
A git URL may include `#BRANCH`, `#TAG`, or `#REV` to select a ref. The ref is
treated as a branch unless it is 7+ hex digits (revision) or looks like a
version (tag). Use an explicit prefix (`#branch:`, `#tag:`, `#rev:`) to
override the detection.
Version: `<OP><VERSION>` where OP is:
- `=` or `==` (exact)
- `>` (greater)
- `<` (less)
- `>=` (greater or equal)
- `<=` (less or equal)
- `~` (major.minor compatible)
Features: `+<FEATURE>` (repeatable).
`+` alone disables defaults.
`++name` does both (disables defaults and adds the feature).
Version must precede features.
Examples:
anyhow
tokio=1.48
clap+derive
anyhow=1.0.100+backtrace
https://github.com/rust-random/rand#thread_rng
https://github.com/rust-random/rand#0.9.0
ssh://git@github.com/serde-rs/serde.git
./my-local-crate
../shared-lib"
))]
pub dependencies: Vec<Dependency>,
#[arg(long, short = 'l')]
pub lib: bool,
#[arg(long, short = 'e')]
pub edition: Option<String>,
#[arg(long = "name", short = 'n')]
pub project_name: Option<String>,
#[arg(long, short = 'b')]
pub bench: Option<Option<String>>,
#[arg(long = "worktree", short = 'w')]
pub worktree_branch: Option<Option<String>>,
#[arg(long, short = 'g')]
pub git: Option<String>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_cli() {
use clap::CommandFactory;
Cli::command().debug_assert();
}
}