added shell completions for push subcommands and pop

This commit is contained in:
2025-01-23 22:23:12 +01:00
parent 6fc7858788
commit 61eb72e69a
2 changed files with 26 additions and 5 deletions
+23 -3
View File
@@ -21,12 +21,32 @@ function book {
__call_navigate "bookmark $@"
}
# completion for `book`
# completion function for `book`
function _book {
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
BOOKMARKS="$(__call_navigate bookmark names)"
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
if [[ COMP_CWORD -eq 1 ]]; then
BOOKMARKS="add remove $(__call_navigate bookmark names)"
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
elif [[ COMP_CWORD -eq 2 ]]; then
if [[ COMP_WORDS[1] -eq "remove" ]]; then
BOOKMARKS="$(__call_navigate bookmark names)"
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
fi
elif [[ COMP_CWORD -eq 3 ]]; then
if [[ COMP_WORDS[1] -eq "add" ]]; then
COMPREPLY=($(compgen -o dirnames -- $CURRENT_WORD))
fi
fi
}
# completion function for `pop`
function _pop {
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
if [[ COMP_CWORD -eq 1 ]]; then
COMPREPLY=($(compgen -W "all <number>"))
fi
}
complete -o dirnames push
complete -F _pop pop
complete -F _book book
+3 -2
View File
@@ -7,7 +7,7 @@
- [x] implement procedural macro for config
- [x] .. to parse config
- [ ] .. to write default config
- [ ] .. ignore comments in config file
- [x] .. ignore comments in config file
- [x] parse config file
- [ ] apply config -- partially more done than before :)
- [x] `show-bookmarks-on-book`
@@ -16,4 +16,5 @@
- [x] bookmarks
- [x] do not resolve links in bookmarks
- [ ] push <number> to push path in stack
- [ ] write documentation
- [/] write documentation
- [x] change config file extension to `.toml`