From d1848e91869fe14a74e0a77ef2a4a53279d44277 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 21 Oct 2017 18:20:41 +0200 Subject: [PATCH] Add CLI spec --- bin/domain/imag-habit/src/ui.rs | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/bin/domain/imag-habit/src/ui.rs b/bin/domain/imag-habit/src/ui.rs index f0259e36..3b2569df 100644 --- a/bin/domain/imag-habit/src/ui.rs +++ b/bin/domain/imag-habit/src/ui.rs @@ -21,4 +21,90 @@ use clap::{Arg, App, SubCommand}; pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { app + .subcommand(SubCommand::with_name("status") + .about("Show the current status. Remind of not-yet-done habits, shows upcoming. Default if no command is passed.") + .version("0.1") + ) + + .subcommand(SubCommand::with_name("create") + .about("Create a new Habit") + .version("0.1") + .arg(Arg::with_name("create-name") + .index(1) + .multiple(false) + .required(true) + .takes_value(true) + .value_name("NAME") + .help("Name of the new habit")) + .arg(Arg::with_name("create-date") + .index(2) + .multiple(false) + .required(true) + .takes_value(true) + .value_name("DATE") + .help("Date when the first instance should be done")) + .arg(Arg::with_name("create-date-recurr-spec") + .index(3) + .multiple(false) + .required(true) + .takes_value(true) + .value_name("RECURRENCE-SPEC") + .help("Spec how the habit should recur (eg: 'weekly', 'monthly', '5days', '12hours')")) + .arg(Arg::with_name("create-comment") + .index(4) + .multiple(true) + .required(true) + .takes_value(true) + .value_name("COMMENT") + .help("Comment for the habit")) + ) + + .subcommand(SubCommand::with_name("delete") + .about("Delete a Habit (and its instances)") + .version("0.1") + .arg(Arg::with_name("delete-instances") + .long("instances") + .short("I") + .multiple(false) + .required(false) + .takes_value(false) + .help("Delete instances as well")) + .arg(Arg::with_name("delete-yes") + .long("yes") + .multiple(false) + .required(false) + .takes_value(false) + .help("Do not ask for confirmation")) + .arg(Arg::with_name("delete-name") + .index(1) + .multiple(false) + .required(true) + .takes_value(true) + .value_name("NAME") + .help("Name of the habit")) + ) + + .subcommand(SubCommand::with_name("list") + .about("List Habits") + .version("0.1") + .arg(Arg::with_name("list-long") + .long("long") + .short("l") + .multiple(false) + .required(false) + .takes_value(false) + .help("List with details (how many instances)")) + ) + + .subcommand(SubCommand::with_name("show") + .about("Show a Habit and its instances") + .version("0.1") + .arg(Arg::with_name("show-name") + .index(1) + .multiple(false) + .required(true) + .takes_value(true) + .value_name("NAME") + .help("Name of the habit to show")) + ) }