mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
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.
This commit is contained in:
committed by
Matan Kushner
parent
740b51bd60
commit
76804cc3c8
+51
-45
@@ -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(),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user