diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-12-11 18:35:07 +0000 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-21 05:19:49 +0100 |
commit | fc7b4109c75299a2ee8debaccc73721338946cfa (patch) | |
tree | f9553d6b42f02629e7289d63b28a68aa68fa3ad4 /apps/cassiopeia/src/bin | |
parent | d40e014aebc778939ae8d9afae225b7d4f6cc949 (diff) |
cassiopeia: changing project structure and adding CLI parsing
Diffstat (limited to 'apps/cassiopeia/src/bin')
-rw-r--r-- | apps/cassiopeia/src/bin/cass.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/cassiopeia/src/bin/cass.rs b/apps/cassiopeia/src/bin/cass.rs new file mode 100644 index 000000000000..cb799d18ccc5 --- /dev/null +++ b/apps/cassiopeia/src/bin/cass.rs @@ -0,0 +1,62 @@ +use cassiopeia::{self as cass, meta}; +use clap::{App, Arg, SubCommand}; + +fn main() { + let app = App::new(meta::NAME) + .version(meta::VERSION) + .about(meta::ABOUT) + .after_help("To learn more on how to use cassiopeia, check out the documentation \ + at https://git.spacekookie.de/kookienomicon/tree/apps/cassiopeia +If you want to report a bug, please do so on my mailing list: lists.sr.ht/~spacekookie/public-inbox") + .author(meta::AUTHOR) + .setting(clap::AppSettings::SubcommandRequiredElseHelp) + .global_settings(&[ + clap::AppSettings::DisableHelpSubcommand, + clap::AppSettings::VersionlessSubcommands, + ]) + .arg( + Arg::with_name(meta::ARG_FILE) + .short("f") + .long("file") + .help(meta::ARG_FILE_ABOUT) + .default_value("./time.cass") + .takes_value(true), + ) + .subcommand( + SubCommand::with_name(meta::CMD_START) + .about(meta::CMD_START_ABOUT) + .arg(Arg::with_name(meta::ARG_ROUNDING).help(meta::ARG_ROUNDING_ABOUT)), + ) + .subcommand( + SubCommand::with_name(meta::CMD_STOP) + .about(meta::CMD_STOP_ABOUT) + .arg(Arg::with_name(meta::ARG_ROUNDING).help(meta::ARG_ROUNDING_ABOUT)), + ) + .subcommand( + SubCommand::with_name(meta::CMD_INVOICE) + .about(meta::CMD_INVOICE_ABOUT) + .arg( + Arg::with_name(meta::ARG_CLIENT) + .short("c") + .long("client") + .takes_value(true) + .help(meta::ARG_CLIENT_ABOUT), + ) + .arg( + Arg::with_name(meta::ARG_PROJECT) + .short("p") + .long("project") + .takes_value(true) + .help(meta::ARG_PROJECT_ABOUT), + ) + .arg( + Arg::with_name(meta::ARG_GEN_YAML) + .short("g") + .long("gen") + .help(meta::ARG_GEN_YAML_ABOUT), + ), + ) + .get_matches(); + + let file = cass::load_file("/home/projects/clients/nyantec-nix-workshops/time.cass"); +} |