diff --git a/misc/bash/_ghq b/misc/bash/_ghq index 4b5677e..483b856 100644 --- a/misc/bash/_ghq +++ b/misc/bash/_ghq @@ -10,7 +10,7 @@ _ghq() { return 0 fi - local vcs_backends="git svn git-svn hg darcs pijul fossil bzr" + local vcs_backends="git github codecommit svn subversion git-svn hg mercurial darcs pijul fossil bzr bazaar" case "${words[1]}" in get|clone) diff --git a/misc/fish/ghq.fish b/misc/fish/ghq.fish index a5814fa..3ee5ca9 100644 --- a/misc/fish/ghq.fish +++ b/misc/fish/ghq.fish @@ -42,6 +42,8 @@ function __complete_get_partial printf '%s\t%s\n' 'treeless' 'Do a treeless clone' end complete -c ghq -n '__fish_seen_subcommand_from get clone' -l partial -d 'Do a partial clone' -xa '(__complete_get_partial)' +# When updating an existing repository (-u/--update), complete with local repositories +complete -c ghq -n '__fish_seen_subcommand_from get clone' -n '__fish_seen_argument -s u -l update' -xa '(ghq list)' complete -c ghq -n '__fish_seen_subcommand_from list' -s e -l exact -d 'Perform an exact match' complete -c ghq -n '__fish_seen_subcommand_from list' -l vcs -d 'Specify vcs backend for matching' @@ -56,6 +58,7 @@ complete -c ghq -n '__fish_seen_subcommand_from rm' -xa '(ghq list)' complete -c ghq -n '__fish_seen_subcommand_from root' -l all -d 'Show all roots' complete -c ghq -n '__fish_seen_subcommand_from create' -l vcs -d 'Specify vcs backend explicitly' +complete -c ghq -n '__fish_seen_subcommand_from create' -l bare -d 'Create a bare repository' complete -c ghq -n '__fish_seen_subcommand_from migrate' -s y -d 'Skip confirmation prompt' complete -c ghq -n '__fish_seen_subcommand_from migrate' -l dry-run -d 'Show what would happen without moving' diff --git a/misc/zsh/_ghq b/misc/zsh/_ghq index 46093d4..dec37fd 100644 --- a/misc/zsh/_ghq +++ b/misc/zsh/_ghq @@ -15,13 +15,13 @@ function _ghq () { case $state in (args) case $words[1] in - (get) + (get|clone) _arguments -C \ '(-u --update)'{-u,--update}'[Update local repository if cloned already]' \ '-p[Clone with SSH]' \ '--shallow[Do a shallow clone]' \ '(-l --look)'{-l,--look}'[Look after get]' \ - '--vcs[Specify vcs backend for cloning]' \ + '--vcs[Specify vcs backend for cloning]: :(git github codecommit svn subversion git-svn hg mercurial darcs pijul fossil bzr bazaar)' \ '(-s --silent)'{-s,--silent}'[Clone or update silently]' \ '--no-recursive[Prevent recursive fetching]' \ '--bare[Do a bare clone]' \ @@ -30,11 +30,14 @@ function _ghq () { '--partial[Do a partial clone]: :(blobless treeless)' \ '(-)*:: :->null_state' \ && ret=0 + if (( ${words[(I)-u]} )) || (( ${words[(I)--update]} )); then + __ghq_all_repositories && ret=0 + fi ;; (list) _arguments -C \ '(-e --exact)'{-e,--exact}'[Perform an exact match]' \ - '--vcs[Specify vcs backend for matching]' \ + '--vcs[Specify vcs backend for matching]: :(git github codecommit svn subversion git-svn hg mercurial darcs pijul fossil bzr bazaar)' \ '(-p --full-path)'{-p,--full-path}'[Print full paths]' \ '--unique[Print unique subpaths]' \ '--bare[Query bare repositories]' \ @@ -49,7 +52,7 @@ function _ghq () { ;; (create) _arguments -C \ - '--vcs[Specify vcs backend explicitly]' \ + '--vcs[Specify vcs backend explicitly]: :(git github codecommit svn subversion git-svn hg mercurial darcs pijul fossil bzr bazaar)' \ '--bare[Create a bare repository]' \ '(-)*:: :->null_state' \ && ret=0 @@ -94,12 +97,14 @@ __ghq_commands () { local -a _c _c=( 'get:Clone/sync with a remote repository' + 'clone:Clone/sync with a remote repository' 'list:List local repositories' 'rm:Remove local repository' 'create:Create a new repository' 'migrate:Migrate existing repository to ghq-managed directory' "root:Show repositories' root" 'help:Show a list of commands or help for one command' + 'h:Show a list of commands or help for one command' ) _describe -t commands Commands _c