diff options
author | Jon Grythe Stødle <jonstodle@outlook.com> | 2019-12-15 00:40:12 +0100 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-12-14 18:40:12 -0500 |
commit | 76804cc3c86a3b423ec801dcce54f386f3be5457 (patch) | |
tree | fd7251da3c4efe8ba4861d16063b5bb9c7de1aed /src/main.rs | |
parent | 740b51bd6071eeb898f91daf81af8b44752ad499 (diff) |
feat: Add `bug-report` sub-command (#725)
This adds a sub command to generate the link. Information, such as operating system and it's version; the current shell's config; and current starship conf, is gathered from the environment and is included in the pre-filled text. The command will also try to open the link in the default browser. Should that fail it will print the link instead and ask the user to copy it.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/src/main.rs b/src/main.rs index cc7e0a519..47c7e80ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ #[macro_use] extern crate clap; +mod bug_report; mod config; mod configs; mod context; @@ -64,51 +65,55 @@ fn main() { .long("print-full-init") .help("Print the main initialization script (as opposed to the init stub)"); - let matches = App::new("starship") - .about("The cross-shell prompt for astronauts. ☄🌌️") - // pull the version number from Cargo.toml - .version(crate_version!()) - // pull the authors from Cargo.toml - .author(crate_authors!()) - .after_help("https://github.com/starship/starship") - .setting(AppSettings::SubcommandRequiredElseHelp) - .subcommand( - SubCommand::with_name("init") - .about("Prints the shell function used to execute starship") - .arg(&shell_arg) - .arg(&init_scripts_arg), - ) - .subcommand( - SubCommand::with_name("prompt") - .about("Prints the full starship prompt") - .arg(&status_code_arg) - .arg(&path_arg) - .arg(&cmd_duration_arg) - .arg(&keymap_arg) - .arg(&jobs_arg), - ) - .subcommand( - SubCommand::with_name("module") - .about("Prints a specific prompt module") - .arg( - Arg::with_name("name") - .help("The name of the module to be printed") - .required(true) - .required_unless("list"), - ) - .arg( - Arg::with_name("list") - .short("l") - .long("list") - .help("List out all supported modules"), - ) - .arg(&status_code_arg) - .arg(&path_arg) - .arg(&cmd_duration_arg) - .arg(&keymap_arg) - .arg(&jobs_arg), - ) - .get_matches(); + let matches = + App::new("starship") + .about("The cross-shell prompt for astronauts. ☄🌌️") + // pull the version number from Cargo.toml + .version(crate_version!()) + // pull the authors from Cargo.toml + .author(crate_authors!()) + .after_help("https://github.com/starship/starship") + .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand( + SubCommand::with_name("init") + .about("Prints the shell function used to execute starship") + .arg(&shell_arg) + .arg(&init_scripts_arg), + ) + .subcommand( + SubCommand::with_name("prompt") + .about("Prints the full starship prompt") + .arg(&status_code_arg) + .arg(&path_arg) + .arg(&cmd_duration_arg) + .arg(&keymap_arg) + .arg(&jobs_arg), + ) + .subcommand( + SubCommand::with_name("module") + .about("Prints a specific prompt module") + .arg( + Arg::with_name("name") + .help("The name of the module to be printed") + .required(true) + .required_unless("list"), + ) + .arg( + Arg::with_name("list") + .short("l") + .long("list") + .help("List out all supported modules"), + ) + .arg(&status_code_arg) + .arg(&path_arg) + .arg(&cmd_duration_arg) + .arg(&keymap_arg) + .arg(&jobs_arg), + ) + .subcommand(SubCommand::with_name("bug-report").about( + "Create a pre-populated GitHub issue with information about your configuration", + )) + .get_matches(); match matches.subcommand() { ("init", Some(sub_m)) => { @@ -132,6 +137,7 @@ fn main() { print::module(module_name, sub_m.clone()); } } + ("bug-report", Some(_)) => bug_report::create(), _ => {} } } |