diff options
| author | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-27 16:31:04 +0100 | 
|---|---|---|
| committer | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-30 15:56:15 +0100 | 
| commit | 27e89cf61dab7b92edd905a50df3429d51c65e79 (patch) | |
| tree | 175ff53a8de2f3a0201eb8da953b16ec1fc9f10a | |
| parent | a0dc8032e1b6bcdbe9b4056ecf30c616a42145ed (diff) | |
| download | sway-27e89cf61dab7b92edd905a50df3429d51c65e79.tar.xz | |
bash: add completion for sway
| -rw-r--r-- | completions/bash/sway | 46 | 
1 files changed, 46 insertions, 0 deletions
diff --git a/completions/bash/sway b/completions/bash/sway new file mode 100644 index 00000000..edd752cd --- /dev/null +++ b/completions/bash/sway @@ -0,0 +1,46 @@ +# sway(1) completion + +_sway() +{ +  local cur prev +  _get_comp_words_by_ref cur prev + +  short=( +    -h +    -c +    -C +    -d +    -v +    -V +  ) + +  long=( +    --help +    --config +    --validate +    --debug +    --version +    --verbose +    --get-socketpath +  ) + +  case $prev in +    -c|--config) +      _filedir +      return +      ;; +  esac + +  if [[ $cur == --* ]]; then +    COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) +  elif [[ $cur == -* ]]; then +    COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) +    COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) +  else +    COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) +    COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) +    COMPREPLY+=($(compgen -c -- "$cur")) +  fi + +} && +complete -F _sway sway  | 
