use std::path::PathBuf;
mod config {
use std::path::PathBuf;
pub struct Config {
pub root_dir: PathBuf,
pub verbose: bool,
}
impl Config {
pub fn new(root_dir: PathBuf) -> Self {
Config {
root_dir,
verbose: false,
}
}
pub fn set_verbose(&mut self, verbose: bool) {
self.verbose = verbose;
}
}
}
pub struct Cli {
pub config_path: PathBuf,
pub dry_run: bool,
}
pub enum Commands {
Install {
name: String,
version: Option<String>,
},
Uninstall {
name: String,
},
Status,
}
impl Cli {
pub fn from_env() -> Self {
Cli {
config_path: PathBuf::from("leindex.toml"),
dry_run: false,
}
}
pub fn run(&self, cmd: &Commands) -> i32 {
match cmd {
Commands::Install { .. } => 0,
Commands::Uninstall { .. } => 0,
Commands::Status => 0,
}
}
}
impl Commands {
pub fn label(&self) -> &str {
match self {
Commands::Install { .. } => "install",
Commands::Uninstall { .. } => "uninstall",
Commands::Status => "status",
}
}
}