use clap::{Args, Parser, Subcommand};
use url::Url;
#[derive(Parser)]
#[command(version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
List(CommonArgs),
Diff(CommonArgs),
Dump(CommonArgs),
Apply {
#[clap(flatten)]
args: CommonArgs,
#[arg(short, long)]
dry_run: bool,
#[arg(long)]
prune: bool,
},
}
#[derive(Args)]
pub struct CommonArgs {
#[arg(
short,
long,
default_value = "https://gitlab.com",
global = true,
env = "GITLAB_URL"
)]
pub url: Url,
#[arg(short, long, env = "GITLAB_TOKEN", hide_env_values = true)]
pub token: String,
#[arg(short, long)]
pub project: Option<String>,
#[arg(short, long)]
pub group: Option<String>,
}