Merge 37b87d7e5e
into f5d61840ae
This commit is contained in:
commit
a1e4dd23d8
|
@ -297,6 +297,7 @@ enable as many segments as you like. It won't slow down your prompt or Zsh start
|
|||
| `laravel_version` | [laravel php framework](https://laravel.com/) version |
|
||||
| `java_version` | [java](https://www.java.com/) version |
|
||||
| `package` | `name@version` from [package.json](https://docs.npmjs.com/files/package.json) |
|
||||
| `docker` | current number of running and exited [docker](https://docker.io/) containers |
|
||||
| `kubecontext` | current [kubernetes](https://kubernetes.io/) context |
|
||||
| `terraform` | [terraform](https://www.terraform.io) workspace |
|
||||
| `aws` | [aws profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) |
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
# battery # internal battery
|
||||
# wifi # wifi speed
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
# docker # Docker containers running and exited (https://www.docker.io)
|
||||
)
|
||||
|
||||
# Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
|
||||
|
@ -275,6 +276,13 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work:
|
||||
# You must also map this drive letter on the windows side:
|
||||
# ```
|
||||
# net use L: \\wsl$\Ubuntu-20.04 /persistent:yes
|
||||
# ```
|
||||
# typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L:
|
||||
|
||||
# Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON
|
||||
# and POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3
|
||||
|
@ -1204,6 +1212,14 @@
|
|||
typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38
|
||||
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]#############
|
||||
# typeset -g POWERLEVEL9K_DOCKER_ICON='🐳'
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON=''
|
||||
|
||||
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
|
||||
# Show kubecontext only when the the command you are typing invokes one of these tools.
|
||||
# Tip: Remove the next line to always show kubecontext.
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
# battery # internal battery
|
||||
# wifi # wifi speed
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
# docker # Docker containers running and exited (https://www.docker.io)
|
||||
)
|
||||
|
||||
# Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
|
||||
|
@ -269,6 +270,13 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work:
|
||||
# You must also map this drive letter on the windows side:
|
||||
# ```
|
||||
# net use L: \\wsl$\Ubuntu-20.04 /persistent:yes
|
||||
# ```
|
||||
# typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L:
|
||||
|
||||
# Enable special styling for non-writable directories. See POWERLEVEL9K_LOCK_ICON and
|
||||
# POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v2
|
||||
|
@ -1152,6 +1160,14 @@
|
|||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]#############
|
||||
# typeset -g POWERLEVEL9K_DOCKER_ICON='🐳'
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON=''
|
||||
|
||||
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
|
||||
# Show kubecontext only when the the command you are typing invokes one of these tools.
|
||||
# Tip: Remove the next line to always show kubecontext.
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
# battery # internal battery
|
||||
# wifi # wifi speed
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
# docker # Docker containers running and exited (https://www.docker.io)
|
||||
)
|
||||
|
||||
# Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
|
||||
|
@ -269,6 +270,13 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work:
|
||||
# You must also map this drive letter on the windows side:
|
||||
# ```
|
||||
# net use L: \\wsl$\Ubuntu-20.04 /persistent:yes
|
||||
# ```
|
||||
# typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L:
|
||||
|
||||
# Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON
|
||||
# and POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3
|
||||
|
@ -1148,6 +1156,14 @@
|
|||
# Custom icon.
|
||||
# typeset -g POWERLEVEL9K_HASKELL_STACK_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]#############
|
||||
# typeset -g POWERLEVEL9K_DOCKER_ICON='🐳'
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON=''
|
||||
|
||||
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
|
||||
# Show kubecontext only when the the command you are typing invokes one of these tools.
|
||||
# Tip: Remove the next line to always show kubecontext.
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
# battery # internal battery
|
||||
# wifi # wifi speed
|
||||
# example # example user-defined segment (see prompt_example function below)
|
||||
# docker # Docker containers running and exited (https://www.docker.io)
|
||||
)
|
||||
|
||||
# Defines character set used by powerlevel10k. It's best to let `p10k configure` set it for you.
|
||||
|
@ -275,6 +276,13 @@
|
|||
# the full directory that was used in previous commands.
|
||||
typeset -g POWERLEVEL9K_DIR_HYPERLINK=false
|
||||
|
||||
# If POWERLEVEL9K_DIR_HYPERLINK is true and using WSL, then set this to make the links work:
|
||||
# You must also map this drive letter on the windows side:
|
||||
# ```
|
||||
# net use L: \\wsl$\Ubuntu-20.04 /persistent:yes
|
||||
# ```
|
||||
# typeset -g POWERLEVEL9K_WSL_NETWORK_DRIVE=L:
|
||||
|
||||
# Enable special styling for non-writable and non-existent directories. See POWERLEVEL9K_LOCK_ICON
|
||||
# and POWERLEVEL9K_DIR_CLASSES below.
|
||||
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=v3
|
||||
|
@ -1271,6 +1279,20 @@
|
|||
typeset -g POWERLEVEL9K_TERRAFORM_OTHER_BACKGROUND=0
|
||||
# typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
#############[ docker: shows the whale when online, and the # running and exited containers (https://www.docker.io/) ]#############
|
||||
# typeset -g POWERLEVEL9K_DOCKER_ICON='🐳'
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_ICON=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_ONLINE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_PAUSE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTAINER_EXIT_VISUAL_IDENTIFIER_EXPANSION=''
|
||||
# typeset -g POWERLEVEL9K_DOCKER_CONTENT_EXPANSION='${DOCKER_ONLINE_CONTENT_EXPANSION}${DOCKER_PAUSE_CONTENT_EXPANSION}${DOCKER_EXIT_CONTENT_EXPANSION}'
|
||||
|
||||
#############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]#############
|
||||
# Show kubecontext only when the the command you are typing invokes one of these tools.
|
||||
# Tip: Remove the next line to always show kubecontext.
|
||||
|
|
|
@ -49,6 +49,7 @@ function _p9k_init_icons() {
|
|||
ANDROID_ICON '\uE270'$s #
|
||||
LINUX_ICON '\uE271'$s #
|
||||
LINUX_ARCH_ICON '\uE271'$s #
|
||||
LINUX_KALI_ICON '\uE271'$s #
|
||||
LINUX_DEBIAN_ICON '\uE271'$s #
|
||||
LINUX_RASPBIAN_ICON '\uE271'$s #
|
||||
LINUX_UBUNTU_ICON '\uE271'$s #
|
||||
|
@ -145,6 +146,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON 'pkg'
|
||||
JULIA_ICON 'jl'
|
||||
SCALA_ICON 'scala'
|
||||
DOCKER_ICON '\UE7B0'
|
||||
DOCKER_CONTAINER_ONLINE_ICON '\UF674'
|
||||
DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #
|
||||
DOCKER_CONTAINER_EXIT_ICON '\UF00D'
|
||||
)
|
||||
;;
|
||||
'awesome-fontconfig')
|
||||
|
@ -182,6 +187,7 @@ function _p9k_init_icons() {
|
|||
ANDROID_ICON '\uE17B'$s # (doesn't always work)
|
||||
LINUX_ICON '\uF17C'$s #
|
||||
LINUX_ARCH_ICON '\uF17C'$s #
|
||||
LINUX_KALI_ICON '\u327F'$s # ㉿
|
||||
LINUX_DEBIAN_ICON '\uF17C'$s #
|
||||
LINUX_RASPBIAN_ICON '\uF17C'$s #
|
||||
LINUX_UBUNTU_ICON '\uF17C'$s #
|
||||
|
@ -274,6 +280,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON 'pkg'
|
||||
JULIA_ICON 'jl'
|
||||
SCALA_ICON 'scala'
|
||||
DOCKER_ICON '\UE7B0'
|
||||
DOCKER_CONTAINER_ONLINE_ICON '\UF674'
|
||||
DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #
|
||||
DOCKER_CONTAINER_EXIT_ICON '\UF00D'
|
||||
)
|
||||
;;
|
||||
'awesome-mapped-fontconfig')
|
||||
|
@ -316,6 +326,7 @@ function _p9k_init_icons() {
|
|||
FREEBSD_ICON '\U1F608'$q # 😈
|
||||
LINUX_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
LINUX_ARCH_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
LINUX_KALI_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
LINUX_DEBIAN_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
LINUX_RASPBIAN_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
LINUX_UBUNTU_ICON "${CODEPOINT_OF_AWESOME_LINUX:+\\u$CODEPOINT_OF_AWESOME_LINUX$s}"
|
||||
|
@ -406,6 +417,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON 'pkg'
|
||||
JULIA_ICON 'jl'
|
||||
SCALA_ICON 'scala'
|
||||
DOCKER_ICON '\UE7B0'
|
||||
DOCKER_CONTAINER_ONLINE_ICON '\UF674'
|
||||
DOCKER_CONTAINER_PAUSE_ICON '\UF04C'
|
||||
DOCKER_CONTAINER_EXIT_ICON '\UF00D'
|
||||
)
|
||||
;;
|
||||
'nerdfont-complete'|'nerdfont-fontconfig')
|
||||
|
@ -443,6 +458,7 @@ function _p9k_init_icons() {
|
|||
FREEBSD_ICON '\UF30C ' #
|
||||
ANDROID_ICON '\uF17B' #
|
||||
LINUX_ARCH_ICON '\uF303' #
|
||||
LINUX_KALI_ICON '\u327F'$s # ㉿
|
||||
LINUX_CENTOS_ICON '\uF304'$s #
|
||||
LINUX_COREOS_ICON '\uF305'$s #
|
||||
LINUX_DEBIAN_ICON '\uF306' #
|
||||
|
@ -536,6 +552,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON '\uF8D6' #
|
||||
JULIA_ICON '\uE624' #
|
||||
SCALA_ICON '\uE737' #
|
||||
DOCKER_ICON '\UE7B0' #
|
||||
DOCKER_CONTAINER_ONLINE_ICON '\UF674' #
|
||||
DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #
|
||||
DOCKER_CONTAINER_EXIT_ICON '\UF00D' #
|
||||
)
|
||||
;;
|
||||
ascii)
|
||||
|
@ -571,6 +591,7 @@ function _p9k_init_icons() {
|
|||
ANDROID_ICON 'android'
|
||||
LINUX_ICON 'linux'
|
||||
LINUX_ARCH_ICON 'arch'
|
||||
LINUX_KALI_ICON 'kali'
|
||||
LINUX_DEBIAN_ICON 'debian'
|
||||
LINUX_RASPBIAN_ICON 'pi'
|
||||
LINUX_UBUNTU_ICON 'ubuntu'
|
||||
|
@ -663,6 +684,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON 'pkg'
|
||||
JULIA_ICON 'jl'
|
||||
SCALA_ICON 'scala'
|
||||
DOCKER_ICON 'docker'
|
||||
DOCKER_CONTAINER_ONLINE_ICON 'o'
|
||||
DOCKER_CONTAINER_PAUSE_ICON '"'
|
||||
DOCKER_CONTAINER_EXIT_ICON 'x'
|
||||
)
|
||||
;;
|
||||
*)
|
||||
|
@ -700,6 +725,7 @@ function _p9k_init_icons() {
|
|||
ANDROID_ICON 'And'
|
||||
LINUX_ICON 'Lx'
|
||||
LINUX_ARCH_ICON 'Arc'
|
||||
LINUX_KALI_ICON 'Kli'
|
||||
LINUX_DEBIAN_ICON 'Deb'
|
||||
LINUX_RASPBIAN_ICON 'RPi'
|
||||
LINUX_UBUNTU_ICON 'Ubu'
|
||||
|
@ -792,6 +818,10 @@ function _p9k_init_icons() {
|
|||
PACKAGE_ICON 'pkg'
|
||||
JULIA_ICON 'jl'
|
||||
SCALA_ICON 'scala'
|
||||
DOCKER_ICON '\UE7B0'
|
||||
DOCKER_CONTAINER_ONLINE_ICON '\UF674'
|
||||
DOCKER_CONTAINER_PAUSE_ICON '\UF04C' #
|
||||
DOCKER_CONTAINER_EXIT_ICON '\UF00D'
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -1307,6 +1307,102 @@ function _p9k_fvm_new() {
|
|||
return 1
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# Docker support - Appears if docker cli can talk to server.
|
||||
# Shows # running and # stopped containers.
|
||||
#
|
||||
# Also commented with instructions on how to write an async segment.
|
||||
#####################################################################
|
||||
# The main prompt_ function adds the prompt segment definitions, but
|
||||
# the data will be computed elsewhere.
|
||||
function prompt_docker() {
|
||||
# Save the length for the last line
|
||||
local -i len=$#_p9k__prompt _p9k__has_upglob
|
||||
|
||||
# Register the segments. Search for _p9k_left_prompt_segment for argument docs
|
||||
_p9k_prompt_segment $0 NONE green DOCKER_ICON 1 '$_p9k__docker_up' '$_p9k__docker_segment'
|
||||
|
||||
# Copy and paste this line; no changes needed.
|
||||
(( _p9k__has_upglob )) || typeset -g "_p9k__segment_val_${_p9k__prompt_side}[_p9k__segment_index]"=$_p9k__prompt[len+1,-1]
|
||||
}
|
||||
|
||||
# The _init function must be named according to the pattern seen here.
|
||||
function _p9k_prompt_docker_init() {
|
||||
# Abort if the command isn't available.
|
||||
(( $+commands[docker] )) || return
|
||||
|
||||
# Declare global variable to hold the segment content
|
||||
typeset -g _p9k__docker_segment=
|
||||
typeset -g _p9k__docker_up=
|
||||
|
||||
# Register this segment for async computation. Again note the pattern
|
||||
_p9k__async_segments_compute+='_p9k_worker_invoke docker _p9k_prompt_docker_compute'
|
||||
}
|
||||
|
||||
# Runs the workers
|
||||
function _p9k_prompt_docker_compute() {
|
||||
(( $+commands[docker] )) || return
|
||||
|
||||
# Copy and paste this line. Follow the pattern and adapt for your segment name.
|
||||
_p9k_worker_async _p9k_prompt_docker_async _p9k_prompt_docker_sync
|
||||
|
||||
# See the other invocations of _p9k_worker_async for examples of argument
|
||||
# passing to the async impl. The sync impl should not take args.
|
||||
}
|
||||
|
||||
# `_async` runs the slow processes and converts the output into variables.
|
||||
#
|
||||
# The content will then be rendered by the segment template that was previously
|
||||
# registered by the _p9k_prompt_segment in the `prompt_` function.
|
||||
#
|
||||
function _p9k_prompt_docker_async() {
|
||||
(( $+commands[docker] )) || return
|
||||
|
||||
local -A container_status_counts
|
||||
container_status_counts=(E 0 U 0 P 0 S 0)
|
||||
|
||||
_p9k__docker_up=
|
||||
_p9k__docker_segment=
|
||||
|
||||
# Minimize all use of subshells and command invocations in general.
|
||||
# Async is not a license to be needlessly slow.
|
||||
for line in ${(f)"$( docker ps -a --format 'table {{ .Status }}' 2>/dev/null)"}; do
|
||||
if (( $? )); then break; fi
|
||||
if [[ "$line" == *(Paused)* ]]; then
|
||||
(( container_status_counts[P]++ ))
|
||||
else
|
||||
(( container_status_counts[${line:0:1}]++ ))
|
||||
fi
|
||||
_p9k__docker_up=1
|
||||
done
|
||||
|
||||
(( ${container_status_counts[U]} )) && \
|
||||
_p9k__docker_segment="%F{green}$(print_icon 'DOCKER_CONTAINER_ONLINE_ICON') ${container_status_counts[U]} %f"
|
||||
|
||||
(( ${container_status_counts[P]} )) && \
|
||||
_p9k__docker_segment+="%F{yellow}$(print_icon 'DOCKER_CONTAINER_PAUSE_ICON') ${container_status_counts[P]} %f"
|
||||
|
||||
(( ${container_status_counts[E]} )) && \
|
||||
_p9k__docker_segment+="%F{red}$(print_icon 'DOCKER_CONTAINER_EXIT_ICON') ${container_status_counts[E]} %f"
|
||||
|
||||
# All vars that may have changed state must be sent to _p9k_print_params
|
||||
_p9k_print_params \
|
||||
_p9k__docker_segment \
|
||||
_p9k__docker_up
|
||||
|
||||
# The function must end with a reset=value
|
||||
echo -E - 'reset=1'
|
||||
}
|
||||
|
||||
# Copy, paste, and rename this function.
|
||||
function _p9k_prompt_docker_sync() {
|
||||
if [[ -n $REPLY ]]; then
|
||||
eval $REPLY
|
||||
_p9k_worker_reply $REPLY
|
||||
fi
|
||||
}
|
||||
##########################################################################
|
||||
|
||||
prompt_fvm() {
|
||||
_p9k_fvm_new || _p9k_fvm_old
|
||||
}
|
||||
|
@ -2087,15 +2183,18 @@ prompt_dir() {
|
|||
|
||||
local content="${(pj.$sep.)parts}"
|
||||
if (( _POWERLEVEL9K_DIR_HYPERLINK && _p9k_term_has_href )) && [[ $_p9k__cwd == /* ]]; then
|
||||
local header=$'%{\e]8;;file://'${${_p9k__cwd//\%/%%25}//'#'/%%23}$'\a%}'
|
||||
local footer=$'%{\e]8;;\a%}'
|
||||
if (( expand )); then
|
||||
_p9k_escape $header
|
||||
header=$_p9k__ret
|
||||
_p9k_escape $footer
|
||||
footer=$_p9k__ret
|
||||
local dirpath=${${_p9k__cwd//\%/%%25}//'#'/%%23}
|
||||
|
||||
if (( $+commands[wslpath] )); then
|
||||
if [[ -n $_POWERLEVEL9K_WSL_NETWORK_DRIVE && $(wslpath -w ${_p9k__cwd}) == \\\\* ]]; then
|
||||
dirpath=$_POWERLEVEL9K_WSL_NETWORK_DRIVE$dirpath
|
||||
elif [[ $dirpath =~ '^(/(mnt/)*(.))/' ]]; then
|
||||
dirpath=$match[3]:${dirpath:${#match[1]}}
|
||||
fi
|
||||
content=$header$content$footer
|
||||
fi
|
||||
|
||||
_p9k_href $'file://'$dirpath $content $expand
|
||||
content=$_p9k__ret
|
||||
fi
|
||||
|
||||
(( expand )) && _p9k_prompt_length "${(e):-"\${\${_p9k__d::=0}+}$content"}" || _p9k__ret=
|
||||
|
@ -2354,6 +2453,26 @@ _p9k_prompt_load_sync() {
|
|||
_p9k_worker_reply $REPLY
|
||||
}
|
||||
|
||||
function _p9k_href() {
|
||||
local link=${${1//\%/%%25}//'#'/%%23}
|
||||
local content=${2:-$1}
|
||||
local expand=$3
|
||||
|
||||
local header=$'%{\e]8;;'${link}$'\a%}'
|
||||
local footer=$'%{\e]8;;\a%}'
|
||||
|
||||
if (( _p9k_term_has_href )) ; then
|
||||
if (( expand )); then
|
||||
_p9k_escape $header
|
||||
header=$_p9k__ret
|
||||
_p9k_escape $footer
|
||||
footer=$_p9k__ret
|
||||
fi
|
||||
content=$header$content$footer
|
||||
fi
|
||||
_p9k__ret=$content
|
||||
}
|
||||
|
||||
# Usage: _p9k_cached_cmd <0|1> <cmd> [args...]
|
||||
#
|
||||
# The first argument says whether to capture stderr (1) or ignore it (0).
|
||||
|
@ -6437,11 +6556,8 @@ function _p9k_clear_instant_prompt() {
|
|||
echo -E - "${(%):- * Zsh will start %Bquickly%b but prompt will %Bjump down%b after initialization.}"
|
||||
echo -E - ""
|
||||
echo -E - "${(%):-For details, see:}"
|
||||
if (( _p9k_term_has_href )); then
|
||||
echo - "${(%):-\e]8;;https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\ahttps://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt\e]8;;\a}"
|
||||
else
|
||||
echo - "${(%):-https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt}"
|
||||
fi
|
||||
_p9k_href 'https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt'
|
||||
echo -E - "$_p9k__ret"
|
||||
echo -E - ""
|
||||
echo - "${(%):-%3F-- console output produced during zsh initialization follows --%f}"
|
||||
echo -E - ""
|
||||
|
@ -8200,6 +8316,7 @@ function _p9k_init_cacheable() {
|
|||
fi
|
||||
case $os_release_id in
|
||||
*arch*) _p9k_set_os Linux LINUX_ARCH_ICON;;
|
||||
*kali*) _p9k_set_os Linux LINUX_KALI_ICON;;
|
||||
*debian*) _p9k_set_os Linux LINUX_DEBIAN_ICON;;
|
||||
*raspbian*) _p9k_set_os Linux LINUX_RASPBIAN_ICON;;
|
||||
*ubuntu*) _p9k_set_os Linux LINUX_UBUNTU_ICON;;
|
||||
|
|
|
@ -1083,6 +1083,7 @@ function os_icon_name() {
|
|||
fi
|
||||
case $os_release_id in
|
||||
*arch*) echo LINUX_ARCH_ICON;;
|
||||
*kali*) echo LINUX_KALI_ICON;;
|
||||
*debian*) echo LINUX_DEBIAN_ICON;;
|
||||
*raspbian*) echo LINUX_RASPBIAN_ICON;;
|
||||
*ubuntu*) echo LINUX_UBUNTU_ICON;;
|
||||
|
|
Loading…
Reference in New Issue