You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nenv/src/args.rs

46 lines
858 B
Rust

use std::ffi::OsString;
1 year ago
use clap::{Parser, Subcommand};
use nenv::repository::NodeVersion;
1 year ago
#[derive(Clone, Debug, Parser)]
#[clap(infer_subcommands = true)]
pub struct Args {
#[command(subcommand)]
pub commmand: Command,
}
#[derive(Clone, Debug, Subcommand)]
pub enum Command {
#[command()]
Install(InstallArgs),
#[command()]
Use(UseArgs),
#[command(short_flag = 'v', aliases = &["--version"])]
Version,
#[command()]
Exec(ExecArgs),
1 year ago
}
#[derive(Clone, Debug, Parser)]
pub struct ExecArgs {
1 year ago
#[arg()]
pub command: String,
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
pub args: Vec<OsString>,
}
#[derive(Clone, Debug, Parser)]
pub struct InstallArgs {
pub version: NodeVersion,
1 year ago
}
#[derive(Clone, Debug, Parser)]
pub struct UseArgs {
#[arg()]
pub version: NodeVersion,
1 year ago
}