Add smug.bash autocomplete script

This commit is contained in:
qowevisa 2024-11-30 08:32:41 +02:00
commit e6e0cb4443

15
completions/smug.bash Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
_smug() {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
if [[ $COMP_CWORD -ge 2 ]]; then
COMPREPLY=()
return 0
fi
# List files in $HOME/.config/smug/ with .yml extension, removing the extension
COMPREPLY=($(compgen -W "$(find "$HOME/.config/smug/" -maxdepth 1 -name '*.yml' -exec basename {} .yml \;)" -- "$cur"))
}
complete -F _smug smug