summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-07-08 09:25:13 -0400
committerDave Reisner <dreisner@archlinux.org>2017-07-08 13:25:43 -0400
commit6def64c8e0b6d6d41b8768db6d8448f8bc320bbf (patch)
tree6763bad2cbc332dc705f6070f2caae34b3ff3501 /shell
parent19dcc3111174284babb30742539bdef4fa8808c9 (diff)
downloadasp32-6def64c8e0b6d6d41b8768db6d8448f8bc320bbf.tar.xz
add set-git-protocol command
While we're at it, separate our help output into two sections, since we're accumulating a growing list of subcommands which operate not on packages, but on the meta level of the asp repo. Closes #15.
Diffstat (limited to 'shell')
-rw-r--r--shell/bash-completion5
-rw-r--r--shell/zsh-completion25
2 files changed, 18 insertions, 12 deletions
diff --git a/shell/bash-completion b/shell/bash-completion
index acff4c8..3c7fc06 100644
--- a/shell/bash-completion
+++ b/shell/bash-completion
@@ -17,6 +17,7 @@ _asp() {
[ALL_PACKAGES]='checkout difflog export list-arches list-repos log shortlog show ls-files'
[LOCAL_PACKAGES]='untrack update'
[NONE]='disk-usage gc help list-all list-local'
+ [PROTO]='set-git-protocol'
)
# flags
@@ -45,6 +46,10 @@ _asp() {
verb=$word
comps=$(ASP_GIT_QUIET=1 \asp list-local | sed 's,.*/,,')
break
+ elif in_array "$word" ${verbs[PROTO]}; then
+ verb=$word
+ comps='git http https'
+ break
elif in_array "$word" ${verbs[NONE]}; then
verb=$word
break
diff --git a/shell/zsh-completion b/shell/zsh-completion
index bcf18e4..13ede7c 100644
--- a/shell/zsh-completion
+++ b/shell/zsh-completion
@@ -17,25 +17,26 @@ _asp_command() {
'log'
'shortlog'
'show'
+ 'set-git-protocol'
'update'
'untrack'
)
-if (( CURRENT == 1 )); then
- _describe -t commands 'asp command' _asp_cmds || compadd "$@"
-else
- local curcontext="$curcontext"
- cmd="${${_asp_cmds[(r)$words[1]:*]%%:*}}"
- if (( $#cmd )); then
- if (( $+functions[_asp_$cmd] )); then
- _asp_$cmd
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'asp command' _asp_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+ cmd="${${_asp_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $#cmd )); then
+ if (( $+functions[_asp_$cmd] )); then
+ _asp_$cmd
+ else
+ _message "no more options"
+ fi
else
- _message "no more options"
+ _message "unknown asp command: $words[1]"
fi
- else
- _message "unknown asp command: $words[1]"
fi
-fi
}
_arguments \