bash-autocomplete-extra/completions/smug.bash

16 lines
370 B
Bash
Raw Normal View History

2024-11-30 07:32:41 +01:00
#!/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