asdfg/
lib.rs

1mod asdf;
2mod commands;
3mod config;
4
5use std::error::Error;
6use structopt::StructOpt;
7
8#[derive(Debug, StructOpt)]
9#[structopt(name = "asdfg", about = "Installing asdf packages from a YAML config.")]
10pub struct Cli {
11    #[structopt(subcommand)]
12    command: Command,
13}
14
15#[derive(Debug, StructOpt)]
16pub enum Command {
17    Install(commands::Install),
18    Config(commands::Config),
19}
20
21pub fn run() -> Result<(), Box<dyn Error>> {
22    match Cli::from_args().command {
23        Command::Install(command) => command.run()?,
24        Command::Config(command) => command.run()?,
25    }
26
27    Ok(())
28}