diff options
author | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-27 16:31:30 +0100 |
---|---|---|
committer | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-30 15:56:15 +0100 |
commit | 4a8a19d21f91a3126d83ac42d6a96900f42ba64c (patch) | |
tree | 417a08b9cc37c07ce01f1084f5f59544b43da874 | |
parent | 21609f8af26b51872ef045ec75cb543835961ead (diff) |
bash: add completion for swaylock
-rw-r--r-- | completions/bash/swaylock | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/completions/bash/swaylock b/completions/bash/swaylock new file mode 100644 index 00000000..33925480 --- /dev/null +++ b/completions/bash/swaylock @@ -0,0 +1,66 @@ +# swaylock(1) completion + +_swaylock() +{ + local cur prev + _get_comp_words_by_ref -n : cur prev + + short=( + -h + -c + -s + -t + -v + -i + -u + -f + ) + + long=( + --help + --color + --scaling + --tiling + --version + --image + --no-unlock-indicator + --daemonize + ) + + scaling=( + 'stretch' + 'fill' + 'fit' + 'center' + 'tile' + ) + + case $prev in + -c|--color) + return + ;; + --scaling) + COMPREPLY=($(compgen -W "${scaling[*]}" -- "$cur")) + return + ;; + -i|--image) + if grep -q : <<< "$cur"; then + output="${cur%%:*}:" + cur="${cur#*:}" + else + output= + fi + COMPREPLY=($(compgen -f -- "$cur")) + return + ;; + esac + + if [[ $cur == --* ]]; then + COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) + else + COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) + COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) + fi + +} && +complete -F _swaylock swaylock |