Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: starship bug-report sets syntax highlighting for config file #3529

Merged
merged 2 commits into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/bug_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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. -->

Expand All @@ -76,7 +85,7 @@ fn make_github_issue_link(environment: Environment) -> String {
- Build Time: {build_time}
#### Relevant Shell Configuration

```bash
```{shell_syntax}
{shell_config}
```

Expand All @@ -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", "+");

Expand Down Expand Up @@ -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 {
Expand Down