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

40 lines
699 B
Rust

1 year ago
use std::str::FromStr;
use clap::{Parser, Subcommand};
use nenv::repository::NodeVersion;
use semver::VersionReq;
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()]
Default,
#[command(short_flag = 'v', aliases = &["--version"])]
Version,
}
#[derive(Clone, Debug, Parser)]
pub struct InstallArgs {
#[arg()]
pub version: NodeVersion,
1 year ago
}
#[derive(Clone, Debug, Parser)]
pub struct UseArgs {
#[arg()]
pub version: NodeVersion,
1 year ago
}