git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGit PATCH 1/2] Modify bash completion to support help, version, and copyright.
@ 2009-01-20  0:46 ted
  2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
  0 siblings, 1 reply; 7+ messages in thread
From: ted @ 2009-01-20  0:46 UTC (permalink / raw)
  To: catalin.marinas; +Cc: git, Ted Pavlic

From: Ted Pavlic <ted@tedpavlic.com>

"stg <tab>" lists all commands, including "help", "version", and
"copyright".

"stg he<tab>" completes "stg help "
"stg ver<tab>" completes "stg version "
"stg copy<tab>" completes "stg copyright "

"stg help <tab>" lists all commands /other than/ help, version, and
copyright.

"stg version <tab>" goes directly to shell completion.
"stg copyright <tab>" goes directly to shell completion.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 stgit/completion.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/stgit/completion.py b/stgit/completion.py
index affc8c6..b3fd282 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -111,13 +111,19 @@ def main_switch(commands):
         ('# Complete name of subcommand if the user has not finished'
          ' typing it yet.'),
         'if test $c -eq $COMP_CWORD -a -z "$command"; then', [
-            ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+            ('COMPREPLY=($(compgen -W "help version copyright $_stg_commands" --'
              ' "${COMP_WORDS[COMP_CWORD]}"))'),
             'return'],
         'fi',
         '',
         '# Complete arguments to subcommands.',
         'case "$command" in', [
+            'help) ', [
+            ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+             ' "${COMP_WORDS[COMP_CWORD]}"))'),
+            'return ;;'],
+            'version) return ;;',
+            'copyright) return ;;'], [
             '%s) _stg_%s ;;' % (cmd, cmd)
             for cmd in sorted(commands.iterkeys())],
         'esac')
-- 
1.6.1.87.g15624

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion.
  2009-01-20  0:46 [StGit PATCH 1/2] Modify bash completion to support help, version, and copyright ted
@ 2009-01-20  0:46 ` ted
  2009-01-22 16:38   ` Ted Pavlic
  2009-01-22 23:29   ` kha/{stable,safe,experimental} updated Karl Hasselström
  0 siblings, 2 replies; 7+ messages in thread
From: ted @ 2009-01-20  0:46 UTC (permalink / raw)
  To: catalin.marinas; +Cc: git, Ted Pavlic

From: Ted Pavlic <ted@tedpavlic.com>

If "-o bashdefault" isn't possible, use old "-o default" only.

(this patch inspired by similar mechanism in Mercurial bash completion
script)

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 stgit/completion.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stgit/completion.py b/stgit/completion.py
index b3fd282..56e81c2 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -129,7 +129,8 @@ def main_switch(commands):
         'esac')
 
 def install():
-    return ['complete -o default -F _stg stg']
+    return ['complete -o bashdefault -o default -F _stg stg 2>/dev/null \\', [
+            'complete -o default -F _stg stg' ] ]
 
 def write_completion(f):
     commands = stgit.commands.get_commands(allow_cached = False)
-- 
1.6.1.87.g15624

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion.
  2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
@ 2009-01-22 16:38   ` Ted Pavlic
  2009-01-22 16:44     ` Ted Pavlic
  2009-01-22 23:29   ` kha/{stable,safe,experimental} updated Karl Hasselström
  1 sibling, 1 reply; 7+ messages in thread
From: Ted Pavlic @ 2009-01-22 16:38 UTC (permalink / raw)
  To: Ted Pavlic; +Cc: catalin.marinas, git

>   def install():
> -    return ['complete -o default -F _stg stg']
> +    return ['complete -o bashdefault -o default -F _stg stg 2>/dev/null \\', [
> +            'complete -o default -F _stg stg' ] ]

Oops -- that second "complete" should have two pipes in front of it...


-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion.
  2009-01-22 16:38   ` Ted Pavlic
@ 2009-01-22 16:44     ` Ted Pavlic
  0 siblings, 0 replies; 7+ messages in thread
From: Ted Pavlic @ 2009-01-22 16:44 UTC (permalink / raw)
  To: catalin.marinas; +Cc: git, Ted Pavlic

If "-o bashdefault" isn't possible, use old "-o default" only.

(this patch inspired by similar mechanism in Mercurial bash completion
script)

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---

This patch corrects a bug in the previous one of the same name. In
particular, the second "complete" lacked the "||" in front of it needed
for proper operation. The first complete command should fail over to the
second if "bashdefault" isn't available.

 stgit/completion.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stgit/completion.py b/stgit/completion.py
index b3fd282..38f0670 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -129,7 +129,8 @@ def main_switch(commands):
         'esac')
 
 def install():
-    return ['complete -o default -F _stg stg']
+    return ['complete -o bashdefault -o default -F _stg stg 2>/dev/null \\', [
+            '|| complete -o default -F _stg stg' ] ]
 
 def write_completion(f):
     commands = stgit.commands.get_commands(allow_cached = False)
-- 
1.6.1.213.g28da8

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* kha/{stable,safe,experimental} updated
  2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
  2009-01-22 16:38   ` Ted Pavlic
@ 2009-01-22 23:29   ` Karl Hasselström
  2009-01-23  0:26     ` [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command Ted Pavlic
  1 sibling, 1 reply; 7+ messages in thread
From: Karl Hasselström @ 2009-01-22 23:29 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: ted, git

Ted, Both of your patches look good, and work when I try them.
(Excellent commit messages, by the way.) I've applied them and pushed
them out.

Catalin, I have stuff for you in both kha/stable and kha/safe.


                                 -+-


The following changes since commit 7cb253c05b509510177a1df4d5813861641968f6:
  Karl Hasselström (1):
        Fix typo

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git stable

Karl Hasselström (1):
      Return None instead of crashing on undefined integer config items

Pete Wyckoff (1):
      stgit.namelength is an integer

 stgit/config.py |    4 +++-
 stgit/utils.py  |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)


                                 -+-


The following changes since commit d3b31eeac6c6fba9352188755164f556faf56e59:
  Catalin Marinas (1):
        Fix the patch argument parsing for the "show" command

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git safe

Gustav Hållberg (7):
      stgit.el: Consistently use symbols rather than strings for patch names
      stgit.el: Make single file diff buffer read-only
      stgit.el: Include stat summary in patch diff
      stgit.el: Add message when there are no patches in the series
      stgit.el: Indicate empty patches
      stgit.el: Minor beautification
      stgit.el: Add optional count argument to stgit-commit

Karl Hasselström (2):
      Return None instead of crashing on undefined integer config items
      Merge branch 'stable'

Pete Wyckoff (1):
      stgit.namelength is an integer

Ted Pavlic (2):
      Modify bash completion to support help, version, and copyright.
      Make bash completion fail to bashdefault before default completion.

 contrib/stgit.el    |  245 ++++++++++++++++++++++++++++-----------------------
 stgit/completion.py |   11 ++-
 stgit/config.py     |    4 +-
 stgit/utils.py      |    2 +-
 4 files changed, 146 insertions(+), 116 deletions(-)


                                 -+-


The following changes since commit e80d43bd9c8baf2bc9913c6c153914403f210872:
  Ted Pavlic (1):
        Make bash completion fail to bashdefault before default completion.

are available in the git repository at:

  git://repo.or.cz/stgit/kha.git experimental

Gustav Hållberg (1):
      stgit.el: (EXPERIMENTAL) Show files modified in work tree

Karl Hasselström (2):
      Read several objects at once with git cat-file --batch
      Diff several trees at once with git diff-tree --stdin

 INSTALL          |    5 +-
 contrib/stgit.el |  272 ++++++++++++++++++++++++++++++++++--------------------
 stgit/lib/git.py |   79 +++++++++++++++-
 stgit/run.py     |   19 ++++
 4 files changed, 266 insertions(+), 109 deletions(-)


-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command.
  2009-01-22 23:29   ` kha/{stable,safe,experimental} updated Karl Hasselström
@ 2009-01-23  0:26     ` Ted Pavlic
  2009-01-23  1:35       ` Karl Hasselström
  0 siblings, 1 reply; 7+ messages in thread
From: Ted Pavlic @ 2009-01-23  0:26 UTC (permalink / raw)
  To: gitster, kha; +Cc: git, catalin.marinas, Ted Pavlic

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---

This is a patch against 

    git://repo.or.cz/stgit/kha.git stable

Unfortunately, the previous "[StGit PATCH 2/2]" had a small bug in it. A
bugfix was posted, but it didn't get picked up in kha/safe. This commit
should be applied against kha/safe to fix the problem.

Alternatively, the patch provided in

    <1232642662-12851-1-git-send-email-ted@tedpavlic.com>

is the proper patch to stgit/master.

Sorry for the extra bother.

 stgit/completion.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/stgit/completion.py b/stgit/completion.py
index 56e81c2..38f0670 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -130,7 +130,7 @@ def main_switch(commands):
 
 def install():
     return ['complete -o bashdefault -o default -F _stg stg 2>/dev/null \\', [
-            'complete -o default -F _stg stg' ] ]
+            '|| complete -o default -F _stg stg' ] ]
 
 def write_completion(f):
     commands = stgit.commands.get_commands(allow_cached = False)
-- 
1.6.1.213.g28da8

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command.
  2009-01-23  0:26     ` [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command Ted Pavlic
@ 2009-01-23  1:35       ` Karl Hasselström
  0 siblings, 0 replies; 7+ messages in thread
From: Karl Hasselström @ 2009-01-23  1:35 UTC (permalink / raw)
  To: Ted Pavlic; +Cc: git, catalin.marinas

On 2009-01-22 19:26:12 -0500, Ted Pavlic wrote:

> -            'complete -o default -F _stg stg' ] ]
> +            '|| complete -o default -F _stg stg' ] ]

Thanks, I've edited the patch and pushed it out again.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-01-23  1:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-20  0:46 [StGit PATCH 1/2] Modify bash completion to support help, version, and copyright ted
2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
2009-01-22 16:38   ` Ted Pavlic
2009-01-22 16:44     ` Ted Pavlic
2009-01-22 23:29   ` kha/{stable,safe,experimental} updated Karl Hasselström
2009-01-23  0:26     ` [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command Ted Pavlic
2009-01-23  1:35       ` Karl Hasselström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).