From 9e34f9dc45e98d5b09cb8ee81a33d4a78c2b98e6 Mon Sep 17 00:00:00 2001 From: Joseph Chung Date: Thu, 27 Jan 2022 21:50:55 +1000 Subject: [PATCH 1/2] feat: Set config file syntax in starship bug-report It seemed unintuitive that the syntax highlighting for the config file was set to bash even when it was known that it was in another language, such as powershell or lua. --- src/bug_report.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bug_report.rs b/src/bug_report.rs index 043b7cfc8554..bed542a80d13 100644 --- a/src/bug_report.rs +++ b/src/bug_report.rs @@ -52,6 +52,15 @@ fn get_pkg_branch_tag() -> &'static str { } fn make_github_issue_link(environment: Environment) -> String { + let shell_syntax = match environment.shell_info.name.as_ref() { + "powershell" => "pwsh", + "fish" => "fish", + "cmd" => "lua", + // GitHub does not seem to support elvish syntax highlighting. + "elvish" => "bash", + _ => "bash", + }; + let body = urlencoding::encode(&format!("#### Current Behavior @@ -76,7 +85,7 @@ fn make_github_issue_link(environment: Environment) -> String { - Build Time: {build_time} #### Relevant Shell Configuration -```bash +```{shell_syntax} {shell_config} ``` @@ -100,6 +109,7 @@ fn make_github_issue_link(environment: Environment) -> String { rust_channel = shadow::RUST_CHANNEL, build_rust_channel = shadow::BUILD_RUST_CHANNEL, build_time = shadow::BUILD_TIME, + shell_syntax = shell_syntax, )) .replace("%20", "+"); From afbd3efa0ffb4c2ee28acf4caa3fb2c8933fb560 Mon Sep 17 00:00:00 2001 From: Joseph Chung Date: Fri, 28 Jan 2022 17:45:47 +1000 Subject: [PATCH 2/2] Support pwsh Co-authored-by: Kevin Song <4605384+chipbuster@users.noreply.github.com> --- src/bug_report.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bug_report.rs b/src/bug_report.rs index bed542a80d13..4dcc7edf1355 100644 --- a/src/bug_report.rs +++ b/src/bug_report.rs @@ -53,7 +53,7 @@ fn get_pkg_branch_tag() -> &'static str { fn make_github_issue_link(environment: Environment) -> String { let shell_syntax = match environment.shell_info.name.as_ref() { - "powershell" => "pwsh", + "powershell" | "pwsh" => "pwsh", "fish" => "fish", "cmd" => "lua", // GitHub does not seem to support elvish syntax highlighting. @@ -193,7 +193,7 @@ fn get_config_path(shell: &str) -> Option { "bash" => Some(".bashrc"), "fish" => Some(".config/fish/config.fish"), "ion" => Some(".config/ion/initrc"), - "powershell" => { + "powershell" | "pwsh" => { if cfg!(windows) { Some("Documents/PowerShell/Microsoft.PowerShell_profile.ps1") } else {