-
-
Save mroth/646c9b85cf2c3475c00b to your computer and use it in GitHub Desktop.
termagotchi minimal CLI code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.