summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoseph Chung <josephchung023@gmail.com>2022-01-28 21:17:49 +1000
committerGitHub <noreply@github.com>2022-01-28 14:17:49 +0300
commitb99d3b8e24554f0cb308ce5bd779975735fe1741 (patch)
treed398291eb29602634d17f8cf410d8f97ea45ff0c /src
parentab99e759a701930bd6c7172ed08722565fe5a53c (diff)
feat: starship bug-report sets syntax highlighting for config file (#3529)
Set the syntax highlighting for the config file in starship bug-report, using the triple backtick syntax.
Diffstat (limited to 'src')
-rw-r--r--src/bug_report.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bug_report.rs b/src/bug_report.rs
index 043b7cfc8..4dcc7edf1 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" => "pwsh",
+ "fish" => "fish",
+ "cmd" => "lua",
+ // GitHub does not seem to support elvish syntax highlighting.
+ "elvish" => "bash",
+ _ => "bash",
+ };
+
let body = urlencoding::encode(&format!("#### Current Behavior
<!-- A clear and concise description of the 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", "+");
@@ -183,7 +193,7 @@ fn get_config_path(shell: &str) -> Option<PathBuf> {
"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 {