[PATCH 0/8] bash completion: more porcelain completions

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/8] bash completion: more porcelain completions

Lee Marlow
This adds basic long option completion for some common commands that I
use, as well as stash name completion.

Lee Marlow (8):
  bash completion: Add completion for 'git clone'
  bash completion: Add completion for 'git clean'
  bash completion: Add completion for 'git init'
  bash completion: Add completion for 'git revert'
  bash completion: More completions for 'git stash'
  bash completion: Add completion for 'git archive'
  bash completion: Add completion for 'git ls-files'
  bash completion: Add completion for 'git mv'

 contrib/completion/git-completion.bash |  143 +++++++++++++++++++++++++++++++-
 git-stash.sh                           |    2 +-
 2 files changed, 143 insertions(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/8] bash completion: Add completion for 'git clone'

Lee Marlow
Added completions for all long options specified in the docs
        --local --no-hardlinks --shared --reference
        --quiet --no-checkout --bare --mirror --origin
        --upload-pack --template= --depth

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 678a155..6ffe259 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -667,6 +667,31 @@ _git_cherry_pick ()
  esac
 }
 
+_git_clone ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "
+ --local
+ --no-hardlinks
+ --shared
+ --reference
+ --quiet
+ --no-checkout
+ --bare
+ --mirror
+ --origin
+ --upload-pack
+ --template=
+ --depth
+ "
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
 _git_commit ()
 {
  __git_has_doubledash && return
@@ -1475,6 +1500,7 @@ _git ()
  checkout)    _git_checkout ;;
  cherry)      _git_cherry ;;
  cherry-pick) _git_cherry_pick ;;
+ clone)       _git_clone ;;
  commit)      _git_commit ;;
  config)      _git_config ;;
  describe)    _git_describe ;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/8] bash completion: Add completion for 'git clean'

Lee Marlow
Added completions for all long options specified in the docs
        --dry-run --quiet

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6ffe259..72be4f1 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -667,6 +667,20 @@ _git_cherry_pick ()
  esac
 }
 
+_git_clean ()
+{
+ __git_has_doubledash && return
+
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "--dry-run --quiet"
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
 _git_clone ()
 {
  local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -1500,6 +1514,7 @@ _git ()
  checkout)    _git_checkout ;;
  cherry)      _git_cherry ;;
  cherry-pick) _git_cherry_pick ;;
+ clean)       _git_clean ;;
  clone)       _git_clone ;;
  commit)      _git_commit ;;
  config)      _git_config ;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/8] bash completion: Add completion for 'git init'

Lee Marlow
Added completions for all long options specified in the docs
        --quiet --bare --template= --shared
        --shared={false|true|umask|group|all|world|everybody}

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 72be4f1..c7a6d92 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -842,6 +842,24 @@ _git_help ()
  __gitcomp "$(__git_all_commands)"
 }
 
+_git_init ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --shared=*)
+ __gitcomp "
+ false true umask group all world everybody
+ " "" "${cur##--shared=}"
+ return
+ ;;
+ --*)
+ __gitcomp "--quiet --bare --template= --shared --shared="
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
 _git_ls_remote ()
 {
  __gitcomp "$(__git_remotes)"
@@ -1524,6 +1542,7 @@ _git ()
  format-patch) _git_format_patch ;;
  gc)          _git_gc ;;
  help)        _git_help ;;
+ init)        _git_init ;;
  log)         _git_log ;;
  ls-remote)   _git_ls_remote ;;
  ls-tree)     _git_ls_tree ;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 4/8] bash completion: Add completion for 'git revert'

Lee Marlow
Added completions for all long options specified in the docs
        --edit --mainline --no-edit --no-commit --signoff

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c7a6d92..6a5c4cd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1264,6 +1264,18 @@ _git_reset ()
  __gitcomp "$(__git_refs)"
 }
 
+_git_revert ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
 _git_rm ()
 {
  __git_has_doubledash && return
@@ -1554,6 +1566,7 @@ _git ()
  rebase)      _git_rebase ;;
  remote)      _git_remote ;;
  reset)       _git_reset ;;
+ revert)      _git_revert ;;
  rm)          _git_rm ;;
  send-email)  _git_send_email ;;
  shortlog)    _git_shortlog ;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 5/8] bash completion: More completions for 'git stash'

Lee Marlow
Add branch subcommand to completions and USAGE for git-stash.sh.
Complete stash names for show, apply, drop, pop, and branch.
Add "--index" long option for apply.

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   12 +++++++++++-
 git-stash.sh                           |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6a5c4cd..a292cbd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1348,7 +1348,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
- local subcommands='save list show apply clear drop pop create'
+ local subcommands='save list show apply clear drop pop create branch'
  local subcommand="$(__git_find_subcommand "$subcommands")"
  if [ -z "$subcommand" ]; then
  __gitcomp "$subcommands"
@@ -1358,6 +1358,16 @@ _git_stash ()
  save,--*)
  __gitcomp "--keep-index"
  ;;
+ apply,--*)
+ __gitcomp "--index"
+ ;;
+ show,--*|apply,--*|drop,--*|pop,--*|branch,--*)
+ COMPREPLY=()
+ ;;
+ show,*|apply,*|drop,*|pop,*|branch,*)
+ __gitcomp "$(git --git-dir="$(__gitdir)" stash list \
+ | sed -n -e 's/:.*//p')"
+ ;;
  *)
  COMPREPLY=()
  ;;
diff --git a/git-stash.sh b/git-stash.sh
index d4609ed..5ad2c4b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright (c) 2007, Nanako Shiraishi
 
-USAGE='[  | save | list | show | apply | clear | drop | pop | create ]'
+USAGE='[  | save | list | show | apply | clear | drop | pop | create | branch ]'
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 6/8] bash completion: Add completion for 'git archive'

Lee Marlow
Added completions for all long options specified in the docs
        --format= --list --verbose
        --prefix= --remote= --exec=
The --format= long option can be completed with available formats
and the --remote= can be completed with defined remote repositories.

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a292cbd..61ea6d9 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -561,6 +561,29 @@ _git_add ()
  COMPREPLY=()
 }
 
+_git_archive ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --format=*)
+ __gitcomp "$(git archive --list)" "" "${cur##--format=}"
+ return
+ ;;
+ --remote=*)
+ __gitcomp "$(__git_remotes)" "" "${cur##--remote=}"
+ return
+ ;;
+ --*)
+ __gitcomp "
+ --format= --list --verbose
+ --prefix= --remote= --exec=
+ "
+ return
+ ;;
+ esac
+ __git_complete_file
+}
+
 _git_bisect ()
 {
  __git_has_doubledash && return
@@ -1548,6 +1571,7 @@ _git ()
  am)          _git_am ;;
  add)         _git_add ;;
  apply)       _git_apply ;;
+ archive)     _git_archive ;;
  bisect)      _git_bisect ;;
  bundle)      _git_bundle ;;
  branch)      _git_branch ;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH 7/8] bash completion: Add completion for 'git ls-files'

Lee Marlow
Added completions for all long options specified in the docs
        --cached --deleted --modified --others --ignored
        --stage --directory --no-empty-directory --unmerged
        --killed --exclude= --exclude-from=
        --exclude-per-directory= --exclude-standard
        --error-unmatch --with-tree= --full-name
        --abbrev --ignored --exclude-per-directory

Signed-off-by: Lee Marlow <[hidden email]>
---
 contrib/completion/git-completion.bash |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 61ea6d9..936cd35 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -883,6 +883,26 @@ _git_init ()
  COMPREPLY=()
 }
 
+_git_ls_files ()
+{
+ __git_has_doubledash && return
+
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "--cached --deleted --modified --others --ignored
+ --stage --directory --no-empty-directory --unmerged
+ --killed --exclude= --exclude-from=
+ --exclude-per-directory= --exclude-standard
+ --error-unmatch --with-tree= --full-name
+ --abbrev --ignored --exclude-per-directory
+ "
+ return
+ ;;
+ esac
+ COMPREPLY=()
+}
+
 _git_ls_remote ()
 {
  __gitcomp "$(__git_remotes)"
@@ -1590,6 +1610,7 @@ _git ()
  help)        _git_help ;;
  init)        _git_init ;;
  log)         _git_log ;;
+ ls-files)    _git_ls_files ;;
  ls-remote)   _git_ls_remote ;;
  ls-tree)     _git_ls_tree ;;
  merge)       _git_merge;;
--
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/8] bash completion: more porcelain completions

Shawn Pearce
In reply to this post by Lee Marlow
Lee Marlow <[hidden email]> wrote:
> This adds basic long option completion for some common commands that I
> use, as well as stash name completion.

Entire series is good.

Acked-by: Shawn O. Pearce <[hidden email]>
 

> Lee Marlow (8):
>   bash completion: Add completion for 'git clone'
>   bash completion: Add completion for 'git clean'
>   bash completion: Add completion for 'git init'
>   bash completion: Add completion for 'git revert'
>   bash completion: More completions for 'git stash'
>   bash completion: Add completion for 'git archive'
>   bash completion: Add completion for 'git ls-files'
>   bash completion: Add completion for 'git mv'
>
>  contrib/completion/git-completion.bash |  143 +++++++++++++++++++++++++++++++-
>  git-stash.sh                           |    2 +-
>  2 files changed, 143 insertions(+), 2 deletions(-)
>

--
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/8] bash completion: more porcelain completions

Junio C Hamano
"Shawn O. Pearce" <[hidden email]> writes:

> Lee Marlow <[hidden email]> wrote:
>> This adds basic long option completion for some common commands that I
>> use, as well as stash name completion.
>
> Entire series is good.
>
> Acked-by: Shawn O. Pearce <[hidden email]>

Have you looked at the last one [PATCH 8/8]?  I do not seem to have it.

>> Lee Marlow (8):
>>   bash completion: Add completion for 'git clone'
>>   bash completion: Add completion for 'git clean'
>>   bash completion: Add completion for 'git init'
>>   bash completion: Add completion for 'git revert'
>>   bash completion: More completions for 'git stash'
>>   bash completion: Add completion for 'git archive'
>>   bash completion: Add completion for 'git ls-files'
>>   bash completion: Add completion for 'git mv'
>>
>>  contrib/completion/git-completion.bash |  143 +++++++++++++++++++++++++++++++-
>>  git-stash.sh                           |    2 +-
>>  2 files changed, 143 insertions(+), 2 deletions(-)
>>
>
> --
> Shawn.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/8] bash completion: more porcelain completions

Shawn Pearce
Junio C Hamano <[hidden email]> wrote:

> "Shawn O. Pearce" <[hidden email]> writes:
> > Lee Marlow <[hidden email]> wrote:
> >> This adds basic long option completion for some common commands that I
> >> use, as well as stash name completion.
> >
> > Entire series is good.
> >
> > Acked-by: Shawn O. Pearce <[hidden email]>
>
> Have you looked at the last one [PATCH 8/8]?  I do not seem to have it.

Yes.  I just sent it back to you and the list.  Hopefully at least
one copy makes it.  ;-)
 
--
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCH] bash: remove redundant check for 'git stash apply' options

SZEDER Gábor
In reply to this post by Lee Marlow
It will never trigger anyway because of the first check, and even if it
would, it would not offer the command line option.

Signed-off-by: SZEDER Gábor <[hidden email]>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 447cb06..5d60f82 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1427,7 +1427,7 @@ _git_stash ()
  apply,--*)
  __gitcomp "--index"
  ;;
- show,--*|apply,--*|drop,--*|pop,--*|branch,--*)
+ show,--*|drop,--*|pop,--*|branch,--*)
  COMPREPLY=()
  ;;
  show,*|apply,*|drop,*|pop,*|branch,*)
--
1.6.0.rc1.104.gf5b36

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] bash: remove redundant check for 'git stash apply' options

Shawn Pearce
SZEDER GGGbor <[hidden email]> wrote:
> It will never trigger anyway because of the first check, and even if it
> would, it would not offer the command line option.
>
> Signed-off-by: SZEDER Gábor <[hidden email]>

Oops.  I should have caught that.  ACK.

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 447cb06..5d60f82 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1427,7 +1427,7 @@ _git_stash ()
>   apply,--*)
>   __gitcomp "--index"
>   ;;
> - show,--*|apply,--*|drop,--*|pop,--*|branch,--*)
> + show,--*|drop,--*|pop,--*|branch,--*)
>   COMPREPLY=()
>   ;;
>   show,*|apply,*|drop,*|pop,*|branch,*)

--
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html