瀏覽代碼

Fixed trailing space issue for options ending with an equal sign

pull/3/head
Tuncer Ayaz 15 年之前
父節點
當前提交
59bfc5044f
共有 1 個檔案被更改,包括 22 行新增6 行删除
  1. +22
    -6
      priv/shell-completion/bash/rebar

+ 22
- 6
priv/shell-completion/bash/rebar 查看文件

@ -2,29 +2,45 @@
_rebar()
{
local cur prev opts
local cur prev sopts lopts cmdsnvars
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
sopts="-h -v -f -j"
lopts=" --help --verbose --force --jobs"
lopts=" --help --verbose --force --jobs="
cmdsnvars="analyze build_plt check_plt clean compile \
create-app create-node eunit generate \
int_test perf_test test \
case= force=1 jobs= suite= verbose=1"
create-app create-node eunit generate \
int_test perf_test test \
case= force=1 jobs= suite= verbose=1"
if [[ ${cur} == --* ]] ; then
COMPREPLY=( $(compgen -W "${lopts}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
# remove trailing space if --lopt=value option
COMPREPLY=${COMPREPLY/%= /=}
fi
return 0
elif [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${sopts}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
fi
return 0
else
COMPREPLY=( $(compgen -W "${cmdsnvars}" -- ${cur}) )
if [ -n "$COMPREPLY" ] ; then
# append space if matched
COMPREPLY="${COMPREPLY} "
# remove trailing space if var= option
COMPREPLY=${COMPREPLY/%= /=}
fi
return 0
fi
}
complete -F _rebar rebar
complete -o nospace -F _rebar rebar
# Local variables:
# mode: shell-script

Loading…
取消
儲存