Powerlevel10k: Issues with ${var:A} expansion and snap

Created on 16 Mar 2020  路  3Comments  路  Source: romkatv/powerlevel10k

I was having issues with the go_version segment not displaying anything and after some debugging, I found the culprit. It seems that the prompt_go_version function doesn't correctly pick up the Go version (https://github.com/romkatv/powerlevel10k/tree/master/internal/p10k.zsh#L2025-L2027)
The root cause is the variable expansion in https://github.com/romkatv/powerlevel10k/tree/master/internal/p10k.zsh#L2251.

Because go was installed with snap the ${commands[go]:A} expansion resolved to snap and, naturally, the output of that command doesn't contain the actual go version.

$ echo ${commands[go]}
/snap/bin/go

$ echo ${commands[go]:A}
/usr/bin/snap

$ ${commands[go]:A} version
snap    2.43.3
snapd   2.43.3
series  16
ubuntu  19.10
kernel  5.3.0-40-generic

Installing go manually works as expected.

I'm not sure if this is a snap or realpath issue, but either way I guess p10k could handle that edge case. I guess this affects any prompt segments which rely on executing snap installed commands with that variable expansion syntax.

All 3 comments

Thanks for the report! Fixed. Please update powerlevel10k and try again. Let me know whether it works for you now.

Thank you for the _prompt_ fix! It's working now :)

Thanks for the confirmation! Your pun is noted :laughing:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kensang248 picture kensang248  路  4Comments

romkatv picture romkatv  路  5Comments

dylanjm picture dylanjm  路  3Comments

stevenguh picture stevenguh  路  6Comments

ImKifu picture ImKifu  路  3Comments