mod commands;
use clap::{App, Arg, SubCommand};
use std::env;
use windsh_core::dirs::WindshDirs;
fn main() {
WindshDirs::load().verify();
let crate_version: String =
env::var("CARGO_PKG_VERSION").expect("Cannot get the package version");
let crate_description: String = env::var("CARGO_PKG_DESCRIPTION")
.expect("Cannot get the package description");
let global_and_start_args = vec![
Arg::with_name("Settings file")
.help("Sets a custom config file")
.short("c")
.long("config")
.value_name("FILE")
.takes_value(true),
Arg::with_name("Private session")
.help("Create a new private windsh session")
.long("private")
.required(false)
.takes_value(false),
Arg::with_name("history file")
.help("Set a custom history file")
.long("history-file")
.value_name("FILE")
.takes_value(true),
];
let matches = App::new("windsh")
.version(crate_version.as_str())
.about(crate_description.as_str())
.args(&global_and_start_args)
.subcommand(
SubCommand::with_name("start")
.about("Create a new windsh session")
.version(crate_version.as_str())
.args(&global_and_start_args),
)
.get_matches();
match matches.subcommand() {
("start", Some(args)) => commands::start::setup(args),
_ => commands::start::setup(&matches),
}
}