use clap::{Args, Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(
name = "nixy",
about = "Homebrew-style wrapper for Nix using flake.nix"
)]
#[command(version)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
#[command(alias = "add")]
Install(InstallArgs),
#[command(alias = "remove")]
Uninstall(UninstallArgs),
#[command(alias = "ls")]
List,
Search {
query: String,
},
Upgrade(UpgradeArgs),
Sync(SyncArgs),
Gc,
Config {
shell: String,
},
Profile(ProfileArgs),
SelfUpgrade(SelfUpgradeArgs),
Version,
}
#[derive(Args)]
pub struct InstallArgs {
pub package: Option<String>,
#[arg(long)]
pub from: Option<String>,
#[arg(long, short)]
pub file: Option<PathBuf>,
#[arg(long)]
pub force: bool,
}
#[derive(Args)]
pub struct UpgradeArgs {
pub inputs: Vec<String>,
}
#[derive(Args)]
pub struct SyncArgs {}
#[derive(Args)]
pub struct UninstallArgs {
pub package: String,
}
#[derive(Args)]
pub struct ProfileArgs {
#[command(subcommand)]
pub command: Option<ProfileCommands>,
}
#[derive(Subcommand)]
pub enum ProfileCommands {
#[command(alias = "use")]
Switch {
name: String,
#[arg(short)]
c: bool,
},
#[command(alias = "ls")]
List,
#[command(alias = "rm")]
Delete {
name: String,
#[arg(long)]
force: bool,
},
}
#[derive(Args)]
pub struct SelfUpgradeArgs {
#[arg(long, short)]
pub force: bool,
}