mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-16 17:50:09 +00:00
Fix java_version segment
This commit is contained in:
parent
8c0df73d81
commit
bda3171237
1 changed files with 6 additions and 1 deletions
|
@ -1713,7 +1713,12 @@ prompt_dropbox() {
|
|||
# print Java version number
|
||||
prompt_java_version() {
|
||||
local java_version
|
||||
java_version=$(java -fullversion 2>/dev/null | cut -d '"' -f 2)
|
||||
# Stupid: Java prints its version on STDERR.
|
||||
# The first version ouput will print nothing, we just
|
||||
# use it to transport whether the command was successful.
|
||||
# If yes, we parse the version string (and need to
|
||||
# redirect the stderr to stdout to make the pipe work).
|
||||
java_version=$(java -version 2>/dev/null && java -fullversion 2>&1 | cut -d '"' -f 2)
|
||||
|
||||
if [[ -n "$java_version" ]]; then
|
||||
"$1_prompt_segment" "$0" "$2" "red" "white" "$java_version" "JAVA_ICON"
|
||||
|
|
Loading…
Reference in a new issue