parent
d40e014aeb
commit
fc7b4109c7
@ -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"); |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
//! Cassiopeia plain text time tracking tool
|
||||||
|
|
||||||
|
mod data; |
||||||
|
mod format; |
||||||
|
pub mod meta; |
||||||
|
|
||||||
|
pub use data::{Session, TimeFile}; |
||||||
|
pub use format::load_file; |
@ -1,9 +0,0 @@ |
|||||||
mod format; |
|
||||||
mod data; |
|
||||||
|
|
||||||
pub use data::{TimeFile, Session}; |
|
||||||
|
|
||||||
fn main() { |
|
||||||
let file = format::load_file("/home/projects/clients/nyantec-nix-workshops/time.cass"); |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,34 @@ |
|||||||
|
//! Metadata and strings for this application
|
||||||
|
// TODO: translate this
|
||||||
|
|
||||||
|
pub const NAME: &'static str = env!("CARGO_PKG_NAME"); |
||||||
|
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); |
||||||
|
pub const AUTHOR: &'static str = env!("CARGO_PKG_AUTHORS"); |
||||||
|
pub const ABOUT: &'static str = env!("CARGO_PKG_DESCRIPTION"); |
||||||
|
|
||||||
|
pub const ARG_FILE: &'static str = "CASS_FILE"; |
||||||
|
pub const ARG_FILE_ABOUT: &'static str = "Provide a .cass file to operate on"; |
||||||
|
|
||||||
|
pub const CMD_START: &'static str = "start"; |
||||||
|
pub const CMD_START_ABOUT: &'static str = "Start a work session"; |
||||||
|
|
||||||
|
pub const CMD_STOP: &'static str = "stop"; |
||||||
|
pub const CMD_STOP_ABOUT: &'static str = "Stop the current work session"; |
||||||
|
|
||||||
|
pub const ARG_ROUNDING: &'static str = "CASS_ROUNDING"; |
||||||
|
pub const ARG_ROUNDING_ABOUT: &'static str = "Disable the (default) 15 minute rounding period"; |
||||||
|
|
||||||
|
pub const CMD_INVOICE: &'static str = "invoice"; |
||||||
|
pub const CMD_INVOICE_ABOUT: &'static str = "Create an invoice"; |
||||||
|
|
||||||
|
pub const ARG_CLIENT: &'static str = "CLIENT"; |
||||||
|
pub const ARG_CLIENT_ABOUT: &'static str = |
||||||
|
"Provide the name of the current client for invoice generation"; |
||||||
|
|
||||||
|
pub const ARG_PROJECT: &'static str = "PROJECT"; |
||||||
|
pub const ARG_PROJECT_ABOUT: &'static str = |
||||||
|
"Provide the name of the current project for invoice generation"; |
||||||
|
|
||||||
|
pub const ARG_GEN_YAML: &'static str = "GEN_YAML"; |
||||||
|
pub const ARG_GEN_YAML_ABOUT: &'static str = |
||||||
|
"Specify whether to generate a .yml invoice configuration"; |
Loading…
Reference in new issue