Skip to content

Instantly share code, notes, and snippets.

@mroth

mroth/main.rs Secret

Created March 24, 2016 18:34
Show Gist options
  • Save mroth/646c9b85cf2c3475c00b to your computer and use it in GitHub Desktop.
Save mroth/646c9b85cf2c3475c00b to your computer and use it in GitHub Desktop.
termagotchi minimal CLI code
#[macro_use]
extern crate clap;
use clap::{App, SubCommand, AppSettings};
fn main() {
let parsed = App::new("termagotchi")
.version( crate_version!() )
.about("A virtual terminal pet.")
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::ArgRequiredElseHelp)
.subcommand(SubCommand::with_name("adopt")
.about("Adopt a new termagotchi™ 🐣")
.usage("termagotchi adopt [-f] [NAME]")
.arg_from_usage("[NAME] 'Optional name to use for your termagotchi™ (autogenerated otherwise)'")
.arg_from_usage("-f, --force 'Do not prompt before overwriting existing termagotchi™'")
)
.subcommand(SubCommand::with_name("abandon")
.about("Abandons your existing termagotchi™!")
.arg_from_usage("-f, --force 'Do not prompt before abandoning existing termagotchi'")
)
.subcommand(SubCommand::with_name("clean")
.about("Clean up any poops 💩")
)
.subcommand(SubCommand::with_name("feed")
.about("Feed your termagotchi™ 🍼")
)
.subcommand(SubCommand::with_name("play")
.about("Play with your termagotchi™")
)
.subcommand(SubCommand::with_name("status")
.about("Display statistics about your termagotchi™")
)
.subcommand(SubCommand::with_name("prompt")
.about("Display the short emoji representation for your termagotchi™")
)
.after_help("See 'termagotchi help <subcommand>' for more information on a specific command.")
.get_matches();
println!("DEBUGGING: REMOVED ALL ACTUAL FUNCTIONALITY");
}
@mroth
Copy link
Author

mroth commented Mar 24, 2016

Here is the actual CLI menu I currently have in my code, but with all functionality and imports removed.

This generates the panic with a terminal width of 80 chars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment