commit e6e0cb44438d567e35577b0a97ad085c210a2493 Author: qowevisa Date: Sat Nov 30 08:32:41 2024 +0200 Add smug.bash autocomplete script diff --git a/completions/smug.bash b/completions/smug.bash new file mode 100644 index 0000000..1ce4376 --- /dev/null +++ b/completions/smug.bash @@ -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