File: git-keeper.completion.bash

package info (click to toggle)
git-keeper 0.20251015.0
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 192 kB
  • sloc: python: 534; sh: 45; makefile: 9
file content (42 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
_comp_cmd_git_keeper()
{
  local cur prev words cword
  _get_comp_words_by_ref cur prev words cword
  word1="${COMP_WORDS[1]}"
  COMPREPLY=()

  if [ $COMP_CWORD -eq 1 ]; then
    COMPREPLY=( $(compgen -W "status commit update vcs ls diff help" -- "$cur") )
    return 0
  elif [ $COMP_CWORD -eq 2 ]; then
    case "$word1" in
      status|commit|update|vcs|diff)
        local options
        if options="$(git-keeper ls </dev/null 2>/dev/null)"; then
          COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
        else
          COMPREPLY=()
        fi
        return 0
        ;;
    esac
  elif [ $COMP_CWORD -ge 3 ]; then
    case "$word1" in
      vcs)
        . /usr/share/bash-completion/completions/git
        COMP_LINE="git ${COMP_WORDS[*]:3}"
        COMP_WORDS=( git "${COMP_WORDS[@]:3}" )
        ((COMP_CWORD -= 2))
        __git_wrap__git_main
        ;;
    esac
  fi
} && complete -o bashdefault -o default -o nospace -F _comp_cmd_git_keeper git-keeper

_comp_cmd_gitkp()
{
  . /usr/share/bash-completion/completions/git
  COMP_LINE="git ${COMP_WORDS[*]:1}"
  COMP_WORDS=( git "${COMP_WORDS[@]:1}" )
  __git_wrap__git_main
} && complete -o bashdefault -o default -o nospace -F _comp_cmd_gitkp gitkp