JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.38k stars 2.38k forks source link

Git segment icon/branch missing with Powerlevel10k_rainbow on WSL 2 #1474

Closed arundeep78 closed 2 years ago

arundeep78 commented 2 years ago

Code of Conduct

What happened?

I installed Oh my posh on WSL Debian using this blog. Everything seems to work fine except themes that use some icons. I have only experienced it with git so far. When I use powerlevel10k_rainbow, I do not get Github icon, neither the branch name. However, when I use powerlevel10k_classic then I do get branch name. Any other theme that should display github icon fails in the same way. I do get however icon for python. Not sure what is missing in some setup or configuration. I am setting up ZSH, oh-my-posh for the first time, so I might have missed some pre-requisite, but did not see anywhere in the documentation.

While generating log, I noticed that below command works with full path. But if I give ~/.poshtheme..... then it gives an error that file not found

Oh My Posh Error: stat ~/.poshthemes/powerlevel10k_rainbow.omp.json: no such file or directory

oh-my-posh --debug --shell uni --config="/home/arundeep/.poshthemes/powerlevel10k_rainbow .omp.json"

Thanks for help or pointing me to the correct configuration pla_classic_git_text1

pl_rainbow

Theme

powerlevel10k_rainbow or anyone that should display git icon e.g. jandedobbeleer

What OS are you seeing the problem on?

Linux

Which shell are you using?

zsh

Log output

oh-my-posh --debug --shell uni --config="/home/arundeep/.poshthemes/powerlevel10k_rainbow
.omp.json"

Version: 6.37.1

Segments:

ConsoleTitle(true)   -   0 ms - uni in test
os(true)             -   0 ms - ╭─ WSL - 
path(true)           -   0 ms -   ~/projects/experiments/test 
git(true)            -   1 ms -    ≢ 
node(false)          -   0 ms -
go(false)            -   0 ms -
julia(false)         -   0 ms -
python(true)         -  51 ms -    
ruby(false)          -   0 ms -
azfunc(false)        -   0 ms -
aws(false)           -   0 ms -
root(false)          -   0 ms -
executiontime(false) -   0 ms -
exit(true)           -   0 ms -  ✔ 
time(true)           -   0 ms -  16:45:24  ─╮
text(true)           -   0 ms - ╰─
text(true)           -   0 ms - ─╯

Run duration: 60.946024ms

Logs:

2021/12/21 16:45:23 debug: getenv

2021/12/21 16:45:23 getenv duration: 4.919µs, args: XDG_CACHE_HOME
2021/12/21 16:45:23 getCachePath duration: 19.447µs, args:
2021/12/21 16:45:23 getArgs duration: 61ns, args:
2021/12/21 16:45:23 getArgs duration: 30ns, args:
2021/12/21 16:45:23 getShellName duration: 130ns, args:
2021/12/21 16:45:23 debug: getenv

2021/12/21 16:45:23 getenv duration: 1.313µs, args: OMP_CACHE_DISABLED
2021/12/21 16:45:23 isRunningAsRoot duration: 420ns, args:
2021/12/21 16:45:23 getcwd duration: 12.724µs, args:
2021/12/21 16:45:23 getPathSeperator duration: 60ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 31ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 getShellName duration: 30ns, args:
2021/12/21 16:45:23 getCurrentUser duration: 221ns, args:
2021/12/21 16:45:23 getHostName duration: 1.432µs, args:
2021/12/21 16:45:23 getcwd duration: 130ns, args:
2021/12/21 16:45:23 getRuntimeGOOS duration: 40ns, args:
2021/12/21 16:45:23 debug: getenv
Debian
2021/12/21 16:45:23 getenv duration: 1.031µs, args: WSL_DISTRO_NAME
2021/12/21 16:45:23 getcwd duration: 50ns, args:
2021/12/21 16:45:23 getcwd duration: 31ns, args:
2021/12/21 16:45:23 getArgs duration: 40ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getRuntimeGOOS duration: 30ns, args:
2021/12/21 16:45:23 getRuntimeGOOS duration: 20ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 40ns, args:
2021/12/21 16:45:23 getRuntimeGOOS duration: 30ns, args:
2021/12/21 16:45:23 stackCount duration: 80ns, args:
2021/12/21 16:45:23 getcwd duration: 50ns, args:
2021/12/21 16:45:23 getRuntimeGOOS duration: 30ns, args:
2021/12/21 16:45:23 debug: getenv
Debian
2021/12/21 16:45:23 getenv duration: 1.012µs, args: WSL_DISTRO_NAME
2021/12/21 16:45:23 isWsl duration: 2.485µs, args:
2021/12/21 16:45:23 getcwd duration: 31ns, args:
2021/12/21 16:45:23 hasCommand duration: 60.145µs, args: git
2021/12/21 16:45:23 getcwd duration: 60ns, args:
2021/12/21 16:45:23 hasParentFilePath duration: 3.176µs, args: .git
2021/12/21 16:45:23 error: runCommand
exit status 129
2021/12/21 16:45:23 runCommand duration: 924.629µs, args: git -C  --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --branch --porcelain=2
2021/12/21 16:45:23 hasFolder duration: 7.164µs, args: /home/arundeep/projects/experiments/test/.git/rebase-merge
2021/12/21 16:45:23 hasFolder duration: 2.275µs, args: /home/arundeep/projects/experiments/test/.git/rebase-apply
2021/12/21 16:45:23 getPathSeperator duration: 110ns, args:
2021/12/21 16:45:23 hasFilesInDir duration: 6.282µs, args: MERGE_MSG
2021/12/21 16:45:23 getPathSeperator duration: 60ns, args:
2021/12/21 16:45:23 hasFilesInDir duration: 5.33µs, args: CHERRY_PICK_HEAD
2021/12/21 16:45:23 getPathSeperator duration: 70ns, args:
2021/12/21 16:45:23 hasFilesInDir duration: 4.809µs, args: REVERT_HEAD
2021/12/21 16:45:23 getPathSeperator duration: 70ns, args:
2021/12/21 16:45:23 hasFilesInDir duration: 4.599µs, args: sequencer/todo
2021/12/21 16:45:23 error: getFileContent
open /home/arundeep/projects/experiments/test/.git/logs/refs/stash: no such file or directory
2021/12/21 16:45:23 getFileContent duration: 7.855µs, args: /home/arundeep/projects/experiments/test/.git/logs/refs/stash
2021/12/21 16:45:23 getcwd duration: 331ns, args:
2021/12/21 16:45:23 getcwd duration: 31ns, args:
2021/12/21 16:45:23 getcwd duration: 40ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 40ns, args:
2021/12/21 16:45:23 hasFiles duration: 48.282µs, args: *.js
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 8.456µs, args: *.ts
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 4.028µs, args: package.json
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 3.136µs, args: .nvmrc
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 3.347µs, args: pnpm-workspace.yaml
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 3.136µs, args: .pnpmfile.cjs
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 2.796µs, args: .npmrc
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 7.364µs, args: *.go
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 3.267µs, args: go.mod
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 20ns, args:
2021/12/21 16:45:23 hasFiles duration: 6.903µs, args: *.jl
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getcwd duration: 30ns, args:
2021/12/21 16:45:23 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:23 hasFiles duration: 7.724µs, args: *.py
2021/12/21 16:45:23 error: hasCommand
exec: "python": executable file not found in $PATH
2021/12/21 16:45:23 hasCommand duration: 26.064316ms, args: python
2021/12/21 16:45:24 error: hasCommand
exec: "python3": executable file not found in $PATH
2021/12/21 16:45:24 hasCommand duration: 25.681531ms, args: python3
2021/12/21 16:45:24 getcwd duration: 391ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getcwd duration: 20ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 40ns, args:
2021/12/21 16:45:24 hasFiles duration: 31.109µs, args: *.rb
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 hasFiles duration: 3.927µs, args: Rakefile
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 hasFiles duration: 3.417µs, args: Gemfile
2021/12/21 16:45:24 getcwd duration: 31ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 hasFiles duration: 3.266µs, args: host.json
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 20ns, args:
2021/12/21 16:45:24 hasFiles duration: 3.166µs, args: local.settings.json
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 hasFiles duration: 3.126µs, args: function.json
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 debug: getenv

2021/12/21 16:45:24 getenv duration: 1.112µs, args: AWS_VAULT
2021/12/21 16:45:24 debug: getenv

2021/12/21 16:45:24 getenv duration: 982ns, args: AWS_PROFILE
2021/12/21 16:45:24 debug: getenv

2021/12/21 16:45:24 getenv duration: 732ns, args: AWS_REGION
2021/12/21 16:45:24 debug: getenv

2021/12/21 16:45:24 getenv duration: 721ns, args: AWS_DEFAULT_REGION
2021/12/21 16:45:24 debug: getenv

2021/12/21 16:45:24 getenv duration: 772ns, args: AWS_CONFIG_FILE
2021/12/21 16:45:24 error: getFileContent
open /home/arundeep/.aws/config: no such file or directory
2021/12/21 16:45:24 getFileContent duration: 4.018µs, args: /home/arundeep/.aws/config
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 isRunningAsRoot duration: 851ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 executionTime duration: 250ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 lastErrorCode duration: 110ns, args:
2021/12/21 16:45:24 getcwd duration: 141ns, args:
2021/12/21 16:45:24 getcwd duration: 271ns, args:
2021/12/21 16:45:24 isRunningAsRoot duration: 400ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 40ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getShellName duration: 271ns, args:
2021/12/21 16:45:24 getCurrentUser duration: 240ns, args:
2021/12/21 16:45:24 getHostName duration: 1.433µs, args:
2021/12/21 16:45:24 getcwd duration: 80ns, args:
2021/12/21 16:45:24 isRunningAsRoot duration: 281ns, args:
2021/12/21 16:45:24 getcwd duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 40ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 20ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 30ns, args:
2021/12/21 16:45:24 getPathSeperator duration: 31ns, args:
2021/12/21 16:45:24 getShellName duration: 80ns, args:
2021/12/21 16:45:24 getCurrentUser duration: 141ns, args:
2021/12/21 16:45:24 getHostName duration: 651ns, args:
JanDeDobbeleer commented 2 years ago

@arundeep78 the problem seems to be git. The command git -C --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --branch --porcelain=2 errors with exit code 129. I see the -C parameter isn't filled in, which makes it fail.

JanDeDobbeleer commented 2 years ago

@arundeep78 did a small fix, BUT, you might also want to update git.

arundeep78 commented 2 years ago

@JanDeDobbeleer Thanks for fast response. So I can update Oh-my-posh with new release using this command?

sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh

When I tried it, the issue still remains.

apt install git says that git is the latest version on this Debian instance.

Reading package lists... Done Building dependency tree Reading state information... Done git is already the newest version (1:2.11.0-3+deb9u7).

arundeep78 commented 2 years ago

I ran the debug again and noticed that the error message you pointed out has changed now to below message

2021/12/21 22:11:39 error: runCommand cmd.Start() failed with 'Unknown option: --no-optional-locks usage: git [--version] [--help] [-C ] [-c name=value] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [] ' 2021/12/21 22:11:39 runCommand duration: 1.534888ms, args: git -C /home/arundeep/projects/experiments/test/ --no-optional-locks -c core.quotepath=false -c color.status=false status -unormal --branch --porcelain=2

JanDeDobbeleer commented 2 years ago

@arundeep78 git 2.11 is 5 years old. I don't care what Debian says, that's simply not OK.

This could do the trick (didn't validate):

sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version
arundeep78 commented 2 years ago

@JanDeDobbeleer Sorry, I just installed this Debian yesterday on WSL2 and naively assumed that it is latest. Just checked that it was Debian 9/stretch!! Upgrading to Debian 10 then to 11. I should have updated git as well . I will check after upgrade and will update you.

arundeep78 commented 2 years ago

@JanDeDobbeleer It is working now after 2 upgrades of Debian and your help. Thanks a lot

JanDeDobbeleer commented 2 years ago

No need to say sorry. Good to hear it's resolved!

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.