use clap::{Parser, Subcommand};
use log::LevelFilter;
use simplelog::{Config, TermLogger, TerminalMode};
mod core;
#[derive(Parser)]
struct Cli {
#[clap(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
New {
#[clap(short, long)]
author: Option<String>,
name: String,
#[clap(long)]
no_vcs: bool,
},
Init {
#[clap(short, long)]
author: Option<String>,
name: String,
},
Init {
name: String,
#[clap(long)]
no_vcs: bool,
},
}
#[tokio::main]
async fn main() {
TermLogger::init(
LevelFilter::Info,
Config::default(),
TerminalMode::Mixed,
simplelog::ColorChoice::Auto,
)
.expect("Unable to init logger");
let cli = Cli::parse();
match cli.command {
Commands::New {
author,
name,
no_vcs,
} => {
let author = if let Some(a) = author {
a
} else {
String::new()
};
core::create(author, name, no_vcs);
}
Commands::Init { name } => {
core::init(name);
}
Commands::Init {
author,
name,
no_vcs,
} => {
let author = if let Some(a) = author {
a
} else {
String::new()
};
core::init(author, name, no_vcs);
}
}
}