mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-25 13:30:07 +00:00
s/_p9k_upsearch/_p9k_upglob/g
This commit is contained in:
parent
34d34eb112
commit
286ba2a84b
1 changed files with 10 additions and 10 deletions
|
@ -264,14 +264,14 @@ function _p9k_glob() {
|
||||||
return $#files
|
return $#files
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage: _p9k_upsearch pattern
|
# Usage: _p9k_upglob pattern
|
||||||
#
|
#
|
||||||
# Returns index within _p9k__parent_dirs or 0 if there is no match.
|
# Returns index within _p9k__parent_dirs or 0 if there is no match.
|
||||||
#
|
#
|
||||||
# Pattern cannot have slashes. Never matches in / or ~. Search stops before reaching / or ~.
|
# Pattern cannot have slashes. Never matches in / or ~. Search stops before reaching / or ~.
|
||||||
#
|
#
|
||||||
# Example: _p9k_upsearch '*.csproj'
|
# Example: _p9k_upglob '*.csproj'
|
||||||
function _p9k_upsearch() {
|
function _p9k_upglob() {
|
||||||
local cached=$_p9k__upsearch_cache[$_p9k__cwd/$1]
|
local cached=$_p9k__upsearch_cache[$_p9k__cwd/$1]
|
||||||
if [[ -n $cached ]]; then
|
if [[ -n $cached ]]; then
|
||||||
if [[ $_p9k__parent_mtimes_s == ${cached% *}(| *) ]]; then
|
if [[ $_p9k__parent_mtimes_s == ${cached% *}(| *) ]]; then
|
||||||
|
@ -1133,7 +1133,7 @@ _p9k_prompt_aws_init() {
|
||||||
################################################################
|
################################################################
|
||||||
# Current Elastic Beanstalk environment
|
# Current Elastic Beanstalk environment
|
||||||
prompt_aws_eb_env() {
|
prompt_aws_eb_env() {
|
||||||
_p9k_upsearch .elasticbeanstalk && return
|
_p9k_upglob .elasticbeanstalk && return
|
||||||
local dir=$_p9k__parent_dirs[$?]
|
local dir=$_p9k__parent_dirs[$?]
|
||||||
|
|
||||||
if ! _p9k_cache_stat_get $0 $dir/.elasticbeanstalk/config.yml; then
|
if ! _p9k_cache_stat_get $0 $dir/.elasticbeanstalk/config.yml; then
|
||||||
|
@ -1225,7 +1225,7 @@ function _p9k_read_file() {
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_fvm() {
|
prompt_fvm() {
|
||||||
_p9k_upsearch fvm && return
|
_p9k_upglob fvm && return
|
||||||
local link=$_p9k__parent_dirs[$?]/fvm
|
local link=$_p9k__parent_dirs[$?]/fvm
|
||||||
if [[ -L $link ]]; then
|
if [[ -L $link ]]; then
|
||||||
if [[ ${link:A} == (#b)*/versions/([^/]##)/bin/flutter ]]; then
|
if [[ ${link:A} == (#b)*/versions/([^/]##)/bin/flutter ]]; then
|
||||||
|
@ -2025,7 +2025,7 @@ prompt_go_version() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ $_p9k__cwd/ != $p/* && $_p9k__cwd_a/ != $p/* ]]; then
|
if [[ $_p9k__cwd/ != $p/* && $_p9k__cwd_a/ != $p/* ]]; then
|
||||||
_p9k_upsearch go.mod && return
|
_p9k_upglob go.mod && return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
_p9k_prompt_segment "$0" "green" "grey93" "GO_ICON" 0 '' "${v//\%/%%}"
|
_p9k_prompt_segment "$0" "green" "grey93" "GO_ICON" 0 '' "${v//\%/%%}"
|
||||||
|
@ -2191,7 +2191,7 @@ function _p9k_cached_cmd_stdout_stderr() {
|
||||||
# Segment to diplay Node version
|
# Segment to diplay Node version
|
||||||
prompt_node_version() {
|
prompt_node_version() {
|
||||||
if (( _POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY )); then
|
if (( _POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY )); then
|
||||||
_p9k_upsearch package.json && return
|
_p9k_upglob package.json && return
|
||||||
fi
|
fi
|
||||||
_p9k_cached_cmd_stdout node --version && [[ $_p9k_ret == v?* ]] || return
|
_p9k_cached_cmd_stdout node --version && [[ $_p9k_ret == v?* ]] || return
|
||||||
_p9k_prompt_segment "$0" "green" "white" 'NODE_ICON' 0 '' "${_p9k_ret#v}"
|
_p9k_prompt_segment "$0" "green" "white" 'NODE_ICON' 0 '' "${_p9k_ret#v}"
|
||||||
|
@ -2353,7 +2353,7 @@ prompt_nodenv() {
|
||||||
_p9k_ret=$NODENV_VERSION
|
_p9k_ret=$NODENV_VERSION
|
||||||
if [[ -z $_p9k_ret ]]; then
|
if [[ -z $_p9k_ret ]]; then
|
||||||
if [[ $NODENV_DIR == (|.) ]]; then
|
if [[ $NODENV_DIR == (|.) ]]; then
|
||||||
_p9k_upsearch .node-version
|
_p9k_upglob .node-version
|
||||||
local -i idx=$?
|
local -i idx=$?
|
||||||
(( idx )) && _p9k_read_nodenv_version_file $_p9k__parent_dirs[idx]/.node-version || _p9k_ret=
|
(( idx )) && _p9k_read_nodenv_version_file $_p9k__parent_dirs[idx]/.node-version || _p9k_ret=
|
||||||
else
|
else
|
||||||
|
@ -2387,7 +2387,7 @@ _p9k_prompt_nodenv_init() {
|
||||||
|
|
||||||
prompt_dotnet_version() {
|
prompt_dotnet_version() {
|
||||||
if (( _POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY )); then
|
if (( _POWERLEVEL9K_DOTNET_VERSION_PROJECT_ONLY )); then
|
||||||
_p9k_upsearch 'project.json|global.json|packet.dependencies|*.csproj|*.fsproj|*.xproj|*.sln' && return
|
_p9k_upglob 'project.json|global.json|packet.dependencies|*.csproj|*.fsproj|*.xproj|*.sln' && return
|
||||||
fi
|
fi
|
||||||
_p9k_cached_cmd_stdout dotnet --version || return
|
_p9k_cached_cmd_stdout dotnet --version || return
|
||||||
_p9k_prompt_segment "$0" "magenta" "white" 'DOTNET_ICON' 0 '' "$_p9k_ret"
|
_p9k_prompt_segment "$0" "magenta" "white" 'DOTNET_ICON' 0 '' "$_p9k_ret"
|
||||||
|
@ -2494,7 +2494,7 @@ prompt_rbenv() {
|
||||||
else
|
else
|
||||||
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local|global]} )) || return
|
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local|global]} )) || return
|
||||||
if [[ $RBENV_DIR == (|.) ]]; then
|
if [[ $RBENV_DIR == (|.) ]]; then
|
||||||
_p9k_upsearch .ruby-version
|
_p9k_upglob .ruby-version
|
||||||
local -i idx=$?
|
local -i idx=$?
|
||||||
if (( idx )) && _p9k_read_word $_p9k__parent_dirs[idx]/.ruby-version; then
|
if (( idx )) && _p9k_read_word $_p9k__parent_dirs[idx]/.ruby-version; then
|
||||||
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local]} )) || return
|
(( ${_POWERLEVEL9K_RBENV_SOURCES[(I)local]} )) || return
|
||||||
|
|
Loading…
Reference in a new issue