zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#517672: Complete custom/unknown Django management commands
       [not found] <20090301113507.57301f29@sakaki.chris-lamb.co.uk>
@ 2009-03-01 16:12 ` Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2009-03-01 16:12 UTC (permalink / raw)
  To: Chris Lamb, 517672; +Cc: zsh-workers

On Sun, Mar 01, 2009 at 11:35:07AM +0000, Chris Lamb wrote:
> The current completion script for Django's manage.py files hardcodes the
> possible subcommands. However, custom management commands are widespread, so
> it would be nice to at least allow completion.
> 
> Patch attached.

Index: Completion/Unix/Command/_django
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_django,v
retrieving revision 1.1
diff -u -r1.1 _django
--- Completion/Unix/Command/_django	28 Sep 2008 19:38:00 -0000	1.1
+++ Completion/Unix/Command/_django	1 Mar 2009 16:10:12 -0000
@@ -57,6 +57,15 @@
       "testserver:run a development server with data from the given fixture(s)"
       "validate:validate all installed modules"
     )
+
+    for cmd in $(./manage.py --help 2>&1 >/dev/null | \
+        awk -vdrop=1 '{ if (!drop) print substr($0, 3) } /^Available subcommands/ { drop=0 }')
+    do
+        if ! echo $subcommands | grep -qs "${cmd}:"
+        then
+            subcommands+=($cmd)
+        fi
+    done
     
     _describe -t subcommands 'django admin subcommand' subcommands && ret=0
     ;;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-01 16:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090301113507.57301f29@sakaki.chris-lamb.co.uk>
2009-03-01 16:12 ` Bug#517672: Complete custom/unknown Django management commands Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).