53 lines
1.3 KiB
Rust
53 lines
1.3 KiB
Rust
use clap::{Parser, Subcommand};
|
|
|
|
/// Simple program to manage Windows file associations
|
|
#[derive(Parser)]
|
|
#[command(name = "Windows File Association Operator", version, about)]
|
|
pub struct Cli {
|
|
/// The toml file introducing the complete program
|
|
#[arg(
|
|
short = 'c',
|
|
long = "config",
|
|
value_name = "PROG_CONFIG",
|
|
required = true
|
|
)]
|
|
pub(crate) config_file: String,
|
|
|
|
/// The scope where wfassoc operate
|
|
#[arg(short = 'f', long = "for", value_name = "TARGET", value_enum, default_value_t = ForTarget::User)]
|
|
pub(crate) for_which: ForTarget,
|
|
|
|
#[command(subcommand)]
|
|
pub(crate) command: Commands,
|
|
}
|
|
|
|
#[derive(clap::ValueEnum, Clone)]
|
|
pub enum ForTarget {
|
|
#[value(name = "user")]
|
|
User,
|
|
#[value(name = "system")]
|
|
System,
|
|
}
|
|
|
|
// impl From<ForTarget> for RegisterKind {
|
|
// fn from(target: ForTarget) -> Self {
|
|
// match target {
|
|
// ForTarget::User => RegisterKind::User,
|
|
// ForTarget::System => RegisterKind::System,
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Commands {
|
|
/// Register the program
|
|
#[command(name = "register")]
|
|
Register,
|
|
/// Unregister the program
|
|
#[command(name = "unregister")]
|
|
Unregister,
|
|
/// Query file associations
|
|
#[command(name = "query")]
|
|
Query,
|
|
}
|