File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ source=('inputrc'
4242 ' gitattributes'
4343 ' astextplain'
4444 ' git-sdk.sh'
45+ ' sdk.completion'
4546 ' git-update-git-for-windows'
4647 ' git-update'
4748 ' blocked-file-util.c'
@@ -96,6 +97,7 @@ build() {
9697package () {
9798 builddir=build-${MINGW_CHOST}
9899 install -d -m755 $pkgdir /etc/profile.d
100+ install -d -m755 $pkgdir /usr/share/bash-completion/completions
99101 install -d -m755 $pkgdir /etc/post-install
100102 install -d -m755 $pkgdir /usr/bin
101103 install -d -m755 $pkgdir /usr/share/git
@@ -118,6 +120,7 @@ package() {
118120 install -m755 env.sh $pkgdir /etc/profile.d
119121 install -m755 bash_profile.sh $pkgdir /etc/profile.d
120122 install -m755 git-sdk.sh $pkgdir /etc/profile.d
123+ install -m755 sdk.completion $pkgdir /usr/share/bash-completion/completions/sdk
121124 install -m644 msys2-32.ico $pkgdir /usr/share/git
122125 install -m644 99-post-install-cleanup.post $pkgdir /etc/post-install
123126 install -m755 astextplain $pkgdir /usr/bin
Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ sdk () {
7171 echo " $* " >&2
7272 return 1
7373 ;;
74+ # for completion
75+ valid_commands)
76+ echo " build cd create-desktop-icon init"
77+ ;;
78+ valid_projects)
79+ echo " build-extra git git-extra MINGW-packages MSYS2-packages"
80+ ;;
81+ # here start the commands
7482 init-lazy)
7583 case " $2 " in
7684 build-extra|git|MINGW-packages|MSYS2-packages)
Original file line number Diff line number Diff line change 1+ _sdk()
2+ {
3+ local cur prev opts
4+ COMPREPLY=()
5+ cur="${COMP_WORDS[COMP_CWORD]}"
6+ prev="${COMP_WORDS[COMP_CWORD-1]}"
7+
8+ case "$prev" in
9+ build|cd|init)
10+ local projects=$(sdk valid_projects)
11+ COMPREPLY=($(compgen -W "$projects" -- $cur))
12+ return 0
13+ ;;
14+ create-desktop-icon)
15+ return 1
16+ ;;
17+ esac
18+
19+ opts=$(sdk valid_commands)
20+ COMPREPLY=($(compgen -W "$opts" -- $cur))
21+ return 0
22+ }
23+ complete -F _sdk sdk
You can’t perform that action at this time.
0 commit comments