updated bash setup script

This commit is contained in:
2025-10-25 12:05:50 +02:00
parent d66f0defb8
commit af40dee02d
+9 -5
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
__call_navigate() { if ! $(which navigate &>/dev/null); then
return 1
fi
function __call_navigate {
arg_pid=" --pid $$ " arg_pid=" --pid $$ "
eval "$(navigate ${arg_pid} $@)" eval "$(navigate ${arg_pid} $@)"
} }
@@ -29,15 +33,15 @@ function navconfig {
function _book { function _book {
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]} CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
if [[ COMP_CWORD -eq 1 ]]; then 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)) COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
elif [[ COMP_CWORD -eq 2 ]]; then elif [[ COMP_CWORD -eq 2 ]]; then
if [[ COMP_WORDS[1] = "remove" ]]; then if [[ "${COMP_WORDS[1]}" = "remove" ]]; then
BOOKMARKS="$(__call_navigate bookmark names)" BOOKMARKS="$(__call_navigate bookmark completions)"
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD)) COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
fi fi
elif [[ COMP_CWORD -eq 3 ]]; then elif [[ COMP_CWORD -eq 3 ]]; then
if [[ COMP_WORDS[1] = "add" ]]; then if [[ "${COMP_WORDS[1]}" = "add" ]]; then
COMPREPLY=($(compgen -o dirnames -- $CURRENT_WORD)) COMPREPLY=($(compgen -o dirnames -- $CURRENT_WORD))
fi fi
fi fi