diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 47eeba25..7aee7885 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -47,10 +47,15 @@ body: label: Which shell are you using? multiple: true options: - - zsh - bash + - elvish - fish + - cmd + - nu - powershell + - xonsh + - tcsh + - zsh - other (please specify) - type: textarea id: logs diff --git a/src/engine/engine.go b/src/engine/engine.go index 35caa89f..fcdd8ee5 100644 --- a/src/engine/engine.go +++ b/src/engine/engine.go @@ -254,6 +254,12 @@ func (e *Engine) renderBlock(block *Block, cancelNewline bool) { // debug will loop through your config file and output the timings for each segments func (e *Engine) PrintDebug(startTime time.Time, version string) string { e.write(fmt.Sprintf("\n%s %s\n", log.Text("Version:").Green().Bold().Plain(), version)) + sh := e.Env.Shell() + shellVersion := e.Env.Getenv("POSH_SHELL_VERSION") + if len(shellVersion) != 0 { + sh += fmt.Sprintf(" (%s)", shellVersion) + } + e.write(fmt.Sprintf("\n%s %s\n", log.Text("Shell:").Green().Bold().Plain(), sh)) e.write(log.Text("\nSegments:\n\n").Green().Bold().Plain().String()) // console title timing titleStartTime := time.Now() diff --git a/src/platform/shell.go b/src/platform/shell.go index 153b5921..b79ba6bb 100644 --- a/src/platform/shell.go +++ b/src/platform/shell.go @@ -642,7 +642,7 @@ func (env *Shell) Shell() string { // this is used for when scoop creates a shim, see // https://github.com/jandedobbeleer/oh-my-posh/issues/2806 executable, _ := os.Executable() - if name == "cmd.exe" || name == executable { + if name == executable { p, _ = p.Parent() name, err = p.Name() env.Debug("parent process name: " + name) diff --git a/src/shell/scripts/omp.bash b/src/shell/scripts/omp.bash index 2f5458d6..f8d69d98 100644 --- a/src/shell/scripts/omp.bash +++ b/src/shell/scripts/omp.bash @@ -1,4 +1,5 @@ export POSH_THEME=::CONFIG:: +export POSH_SHELL_VERSION=$BASH_VERSION export POWERLINE_COMMAND="oh-my-posh" export POSH_PID=$$ export CONDA_PROMPT_MODIFIER=false diff --git a/src/shell/scripts/omp.elv b/src/shell/scripts/omp.elv index 3f9d7d36..81ad4c75 100644 --- a/src/shell/scripts/omp.elv +++ b/src/shell/scripts/omp.elv @@ -1,7 +1,7 @@ set-env POSH_PID (to-string (randint 10000000000000 10000000000000000)) set-env POSH_THEME '::CONFIG::' +set-env POSH_SHELL_VERSION (elvish --version) set-env POWERLINE_COMMAND 'oh-my-posh' -set-env ELVISH_VERSION (elvish --version) var error-code = 0 @@ -23,12 +23,12 @@ set edit:after-command = [ $@edit:after-command $posh-after-command-hook~ ] set edit:prompt = { var cmd-duration = (printf "%.0f" (* $edit:command-duration 1000)) - ::OMP:: print primary --config=$E:POSH_THEME --shell=elvish --execution-time=$cmd-duration --error=$error-code --pwd=$pwd --shell-version=$E:ELVISH_VERSION + ::OMP:: print primary --config=$E:POSH_THEME --shell=elvish --execution-time=$cmd-duration --error=$error-code --pwd=$pwd --shell-version=$E:POSH_SHELL_VERSION } set edit:rprompt = { var cmd-duration = (printf "%.0f" (* $edit:command-duration 1000)) - ::OMP:: print right --config=$E:POSH_THEME --shell=elvish --execution-time=$cmd-duration --error=$error-code --pwd=$pwd --shell-version=$E:ELVISH_VERSION + ::OMP:: print right --config=$E:POSH_THEME --shell=elvish --execution-time=$cmd-duration --error=$error-code --pwd=$pwd --shell-version=$E:POSH_SHELL_VERSION } if (eq '::UPGRADE::' 'true') { diff --git a/src/shell/scripts/omp.fish b/src/shell/scripts/omp.fish index 73e043ac..d1f9dfe1 100644 --- a/src/shell/scripts/omp.fish +++ b/src/shell/scripts/omp.fish @@ -1,4 +1,5 @@ set --export POSH_THEME ::CONFIG:: +set --export POSH_SHELL_VERSION $FISH_VERSION set --global POWERLINE_COMMAND "oh-my-posh" set --global POSH_PID $fish_pid set --global CONDA_PROMPT_MODIFIER false diff --git a/src/shell/scripts/omp.lua b/src/shell/scripts/omp.lua index 03b6189b..09983569 100644 --- a/src/shell/scripts/omp.lua +++ b/src/shell/scripts/omp.lua @@ -75,6 +75,7 @@ local function omp_config() end os.setenv("POSH_THEME", ::CONFIG::) +os.setenv("POSH_SHELL_VERSION", string.format('clink v%s.%s.%s.%s', clink.version_major, clink.version_minor, clink.version_patch, clink.version_commit)) -- Execution helpers diff --git a/src/shell/scripts/omp.nu b/src/shell/scripts/omp.nu index 15ea0d85..15e74836 100644 --- a/src/shell/scripts/omp.nu +++ b/src/shell/scripts/omp.nu @@ -7,10 +7,10 @@ export-env { # making it annoying when you have a multiline prompt # making the behavior different compared to other shells let-env PROMPT_COMMAND_RIGHT = {''} - let-env NU_VERSION = (version | get version) + let-env POSH_SHELL_VERSION = (version | get version) # PROMPTS - let-env PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)") + let-env PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)") let-env PROMPT_COMMAND = { # We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`, @@ -23,7 +23,7 @@ export-env { let clear = (history | last 1 | get 0.command) == "clear" let width = ((term size).columns | into string) - ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)" $"--execution-time=($cmd_duration)" $"--error=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" $"--cleared=($clear)" + ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=($cmd_duration)" $"--error=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" $"--cleared=($clear)" } } diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 0e5ce71c..7d8c99ba 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -22,6 +22,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock { $script:TransientPrompt = $false $script:ToolTipCommand = "" $env:POWERLINE_COMMAND = "oh-my-posh" + $env:POSH_SHELL_VERSION = $script:PSVersion $env:POSH_PID = $PID $env:CONDA_PROMPT_MODIFIER = $false diff --git a/src/shell/scripts/omp.py b/src/shell/scripts/omp.py index 9904d97c..48424207 100644 --- a/src/shell/scripts/omp.py +++ b/src/shell/scripts/omp.py @@ -3,6 +3,7 @@ import uuid $POWERLINE_COMMAND = "oh-my-posh" $POSH_THEME = "::CONFIG::" $POSH_PID = uuid.uuid4().hex +$POSH_SHELL_VERSION = "" def get_command_context(): last_cmd = __xonsh__.history[-1] if __xonsh__.history else None diff --git a/src/shell/scripts/omp.tcsh b/src/shell/scripts/omp.tcsh index 639c2001..cbf4d30b 100644 --- a/src/shell/scripts/omp.tcsh +++ b/src/shell/scripts/omp.tcsh @@ -1,5 +1,6 @@ setenv POWERLINE_COMMAND "oh-my-posh"; setenv POSH_THEME "::CONFIG::"; +setenv POSH_SHELL_VERSION ""; set USER_PRECMD = "`alias precmd`"; set USER_POSTCMD = "`alias postcmd`"; diff --git a/src/shell/scripts/omp.zsh b/src/shell/scripts/omp.zsh index 512db0f4..f0d757e4 100644 --- a/src/shell/scripts/omp.zsh +++ b/src/shell/scripts/omp.zsh @@ -1,4 +1,5 @@ export POSH_THEME=::CONFIG:: +export POSH_SHELL_VERSION=$ZSH_VERSION export POSH_PID=$$ export POWERLINE_COMMAND="oh-my-posh" export CONDA_PROMPT_MODIFIER=false