mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2025-01-15 19:26:54 +00:00
bash doctor
This commit is contained in:
parent
791deec8ac
commit
54d732ae96
@ -62,6 +62,28 @@ fi
|
|||||||
|
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
|
# Report common issues.
|
||||||
|
function __zoxide_doctor() {
|
||||||
|
{%- if hook == InitHook::None %}
|
||||||
|
return 0
|
||||||
|
|
||||||
|
{%- else %}
|
||||||
|
[[ ${_ZO_DOCTOR:-1} -ne 0 ]] || return 0
|
||||||
|
[[ ${PROMPT_COMMAND:=} != *'__zoxide_hook'* ]] || return 0
|
||||||
|
|
||||||
|
_ZO_DOCTOR=0
|
||||||
|
\builtin printf '%s\n' \
|
||||||
|
'zoxide: detected a possible configuration issue.' \
|
||||||
|
'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.bashrc).' \
|
||||||
|
'' \
|
||||||
|
'If the issue persists, consider filing an issue at:' \
|
||||||
|
'https://github.com/ajeetdsouza/zoxide/issues' \
|
||||||
|
'' \
|
||||||
|
'Disable this message by setting _ZO_DOCTOR=0.' \
|
||||||
|
'' >&2
|
||||||
|
{%- endif %}
|
||||||
|
}
|
||||||
|
|
||||||
{{ section }}
|
{{ section }}
|
||||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||||
#
|
#
|
||||||
@ -70,7 +92,7 @@ __zoxide_z_prefix='z#'
|
|||||||
|
|
||||||
# Jump to a directory using only keywords.
|
# Jump to a directory using only keywords.
|
||||||
function __zoxide_z() {
|
function __zoxide_z() {
|
||||||
# shellcheck disable=SC2199
|
__zoxide_doctor
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
__zoxide_cd ~
|
__zoxide_cd ~
|
||||||
elif [[ $# -eq 1 && $1 == '-' ]]; then
|
elif [[ $# -eq 1 && $1 == '-' ]]; then
|
||||||
@ -93,6 +115,7 @@ function __zoxide_z() {
|
|||||||
|
|
||||||
# Jump to a directory using interactive search.
|
# Jump to a directory using interactive search.
|
||||||
function __zoxide_zi() {
|
function __zoxide_zi() {
|
||||||
|
__zoxide_doctor
|
||||||
\builtin local result
|
\builtin local result
|
||||||
result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}"
|
result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}"
|
||||||
}
|
}
|
||||||
@ -154,6 +177,6 @@ fi
|
|||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
|
|
||||||
{{ section }}
|
{{ section }}
|
||||||
# To initialize zoxide, add this to your configuration (usually ~/.bashrc):
|
# To initialize zoxide, add this to your shell configuration file (usually ~/.bashrc):
|
||||||
#
|
#
|
||||||
# eval "$(zoxide init bash)"
|
# eval "$(zoxide init bash)"
|
||||||
|
@ -69,7 +69,7 @@ function __zoxide_doctor() {
|
|||||||
'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.zshrc).' \
|
'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.zshrc).' \
|
||||||
'' \
|
'' \
|
||||||
'If the issue persists, consider filing an issue at:' \
|
'If the issue persists, consider filing an issue at:' \
|
||||||
'https://github.com/ajeetdsouza/zoxide/issues.' \
|
'https://github.com/ajeetdsouza/zoxide/issues' \
|
||||||
'' \
|
'' \
|
||||||
'Disable this message by setting _ZO_DOCTOR=0.' \
|
'Disable this message by setting _ZO_DOCTOR=0.' \
|
||||||
'' >&2
|
'' >&2
|
||||||
|
Loading…
Reference in New Issue
Block a user