From af40dee02d53b26a720b4b18c5d7bb60c37eb2f2 Mon Sep 17 00:00:00 2001 From: zegonix Date: Sat, 25 Oct 2025 12:05:50 +0200 Subject: [PATCH] updated bash setup script --- navigate_bash_setup | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/navigate_bash_setup b/navigate_bash_setup index 7aac625..b0d7f2d 100644 --- a/navigate_bash_setup +++ b/navigate_bash_setup @@ -1,6 +1,10 @@ #!/usr/bin/env bash -__call_navigate() { +if ! $(which navigate &>/dev/null); then + return 1 +fi + +function __call_navigate { arg_pid=" --pid $$ " eval "$(navigate ${arg_pid} $@)" } @@ -29,15 +33,15 @@ function navconfig { function _book { CURRENT_WORD=${COMP_WORDS[COMP_CWORD]} if [[ COMP_CWORD -eq 1 ]]; then - BOOKMARKS="add remove $(__call_navigate bookmark names)" + BOOKMARKS="add remove $(__call_navigate bookmark completions)" COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD)) elif [[ COMP_CWORD -eq 2 ]]; then - if [[ COMP_WORDS[1] = "remove" ]]; then - BOOKMARKS="$(__call_navigate bookmark names)" + if [[ "${COMP_WORDS[1]}" = "remove" ]]; then + BOOKMARKS="$(__call_navigate bookmark completions)" COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD)) fi elif [[ COMP_CWORD -eq 3 ]]; then - if [[ COMP_WORDS[1] = "add" ]]; then + if [[ "${COMP_WORDS[1]}" = "add" ]]; then COMPREPLY=($(compgen -o dirnames -- $CURRENT_WORD)) fi fi