use clap::Parser; use std::path::PathBuf; /// A fictional versioning CLI #[derive(Debug, Parser)] #[clap(name = "cargo-vcs")] #[clap(about = "Version control helper for Cargo", long_about = None)] pub struct Cli { #[clap(subcommand)] pub command: Commands, /// Path to workspace folder, defaults to CWD #[clap(short = 'p')] pub path: Option, } #[derive(Debug, Parser)] pub enum Commands { /// Show workspace status Status { /// Show verbose status information #[clap(short = 'v')] verbose: bool, }, /// Set or save profiles #[clap(subcommand)] Profile(ProfileCommand), /// Set branch globally on workspace #[clap(subcommand)] Branch(BranchCommand), } #[derive(Debug, Parser)] pub enum ProfileCommand { /// Save the current workspace VCS state to Cargo_vcs.toml under given profile name #[clap(arg_required_else_help = true)] Save { profile: String }, /// Switch workspace to given profile #[clap(arg_required_else_help = true)] Set { profile: String }, /// Lists all saved profiles List, } #[derive(Debug, Parser)] pub enum BranchCommand { /// Switch all projects in workspace to given branch #[clap(arg_required_else_help = true)] Set { branch: String }, }