summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Granito <evang@tutamail.com>2026-10-05 22:25:45 -0400
committerOliver Kiddle <opk@zsh.org>2026-10-10 00:55:24 +0200
commite377faa89112fb98d1f85aead429b526eaead80b (patch)
treebfa96ff9b6a5b1148283f6e880b6eb20013b6f29
parent55180: extend libvirt completion with additional only running state commands (diff)
downloadzsh-e377faa89112fb98d1f85aead429b526eaead80b.tar
zsh-e377faa89112fb98d1f85aead429b526eaead80b.tar.gz
zsh-e377faa89112fb98d1f85aead429b526eaead80b.tar.bz2
zsh-e377faa89112fb98d1f85aead429b526eaead80b.tar.lz
zsh-e377faa89112fb98d1f85aead429b526eaead80b.tar.xz
zsh-e377faa89112fb98d1f85aead429b526eaead80b.tar.zst
zsh-e377faa89112fb98d1f85aead429b526eaead80b.zip
55196: _django: skip [section] headers in manage.py --help output
Django groups subcommands by app and prints column-0 section headers such as [auth], [contenttypes], [django]. The current awk filter only drops lines before "Available subcommands" and strips the first two characters of every subsequent line, so those headers survive as bogus entries like "uth]", "jango]", "mber]", corrupting the completion list and producing mangled columnar output. Skip lines starting with "[" and only retain indented lines (the real subcommand entries), stripping the leading whitespace.
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_django10
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e34a35e94..4649d410f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-10-09 Oliver Kiddle <opk@zsh.org>
+ * Evan Granito: 55196: Completion/Unix/Command/_django:
+ skip [section] headers in manage.py --help output
+
* Christopher Bock: 55180: Completion/Unix/Command/_libvirt:
extend with additional only running state commands
diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django
index 1d5cf7311..4893dcb64 100644
--- a/Completion/Unix/Command/_django
+++ b/Completion/Unix/Command/_django
@@ -57,7 +57,15 @@ case $state in
)
for cmd in $(./manage.py --help 2>&1 >/dev/null | \
- awk -v drop=1 '{ if (!drop) print substr($0, 3) } /^Available subcommands/ { drop=0 }')
+ awk -v drop=1 '
+ /^Available subcommands/ { drop = 0; next }
+ drop { next }
+ /^\[/ { next }
+ /^[[:space:]]/ {
+ sub(/^[[:space:]]+/, "")
+ print
+ }
+ ')
do
if ! echo $subcommands | grep -qs "${cmd}:"
then