diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-17 09:07:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-17 09:07:14 +0000 |
commit | fcffaf214966be45ca78fecc6aaa5fae0b42d05a (patch) | |
tree | 666b8c46f7fdbb3a78947221170909a0ccafbb41 /.gita-completion.zsh | |
parent | Adding upstream version 0.16.6.1. (diff) | |
download | gita-upstream.tar.xz gita-upstream.zip |
Adding upstream version 0.16.7.2.upstream/0.16.7.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.gita-completion.zsh')
-rw-r--r-- | .gita-completion.zsh | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/.gita-completion.zsh b/.gita-completion.zsh deleted file mode 100644 index d1fe952..0000000 --- a/.gita-completion.zsh +++ /dev/null @@ -1,46 +0,0 @@ - -_gita_completions() -{ - - local cur commands repos cmd - local COMP_CWORD COMP_WORDS # 定义变量,cur表示当前光标下的单词 - read -cn COMP_CWORD # 所有指令集 - read -Ac COMP_WORDS # 当前指令的索引值 - - cur=${COMP_WORDS[COMP_CWORD]} - cmd=${COMP_WORDS[2]} - - # FIXME: this is somewhat slow - commands=`gita -h | sed '2q;d' |sed 's/[{}.,]/ /g'` - - repos=`gita ls` - # this doesn't work for two repos with the same basename - #gita_path=${XDG_CONFIG_HOME:-$HOME/.config}/gita/repo_path - #repos=`awk '{split($0, paths, ":")} END {for (i in paths) {n=split(paths[i],b, /\//); print b[n]}}' ${gita_path}` - - # FIXME(Steve-Xyh): the secondary auto-completion(such as `$repos`) contains first commands / 二级补全候选项中包含一级补全中的 `$commands` - # XXX(Steve-Xyh): the auto-completion is currently case-sensitive / 当前的补全区分大小写, 应该改成大小写不敏感 - # (Steve-Xyh): args in zsh must be `reply` / zsh 中的参数必须为 `reply` - if [ -z "$cmd" ]; then - reply=($(compgen -W "${commands}" ${cur})) - else - cmd_reply=($(compgen -W "${commands}" ${cmd})) - case $cmd in - add) - reply=(cmd_reply $(compgen -d ${cur})) - ;; - ll) - return - ;; - *) - reply=($cmd_reply $(compgen -W "${repos}" ${cur})) - ;; - esac - fi - -} - -# (Steve-Xyh): functions in zsh must be `compctl` / zsh 中必须用 compctl 函数, -K 表示使用函数 -compctl -K _gita_completions gita - - |