Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#10752 closed (fixed)

Advanced Bash Completion

Reported by: Arthur Koziel Owned by: Arthur Koziel
Component: Core (Management commands) Version: master
Severity: Keywords: bash completion
Cc: flosch@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This patch improves the bash completion. It calls a python function which uses the get_commands() method to return subcommand suggestions. It also goes through the optparse parser to get option suggestions for a subcommand. There are special cases, like the 'runfcgi' command which uses a python dict to store its options.

This makes it possible to have subcommand completion of 3rd party apps (like django-command-extension).

It's a little hard to explain, so I tried to make a screencast:
http://media.arthurkoziel.com/django/bashcomp.mov

Installation hasn't changed, just source the django_bash_completion file from extras/

Attachments (4)

django_bash_completion.diff (9.5 KB) - added by Arthur Koziel 7 years ago.
django_bash_completion.2.diff (9.3 KB) - added by Arthur Koziel 7 years ago.
django_bash_completion.3.diff (9.1 KB) - added by Arthur Koziel 7 years ago.
added "-o default" back in
django_bash_completion.4.diff (9.6 KB) - added by Arthur Koziel 7 years ago.
Added app completion for some commands

Download all attachments as: .zip

Change History (14)

Changed 7 years ago by Arthur Koziel

Attachment: django_bash_completion.diff added

comment:1 Changed 7 years ago by Jannis Leidel

Component: Uncategorizeddjango-admin.py
milestone: 1.21.1
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Jannis Leidel

Needs documentation: set

comment:3 Changed 7 years ago by flosch

Cc: flosch@… added

comment:4 Changed 7 years ago by Jacob

milestone: 1.11.2

comment:5 Changed 7 years ago by Rob Hudson <treborhudson@…>

Just tested it and it works very nicely. Great work! Can't wait for this to land.

Changed 7 years ago by Arthur Koziel

comment:6 Changed 7 years ago by Arthur Koziel

django_bash_completion.2.diff cleans up the code and resolves some inconsistencies with --help and runfcgi.

comment:7 Changed 7 years ago by Arthur Koziel

Owner: changed from nobody to Arthur Koziel

Changed 7 years ago by Arthur Koziel

added "-o default" back in

comment:8 Changed 7 years ago by Eric Holscher

Just wanted to say thanks to arthurk, because I have a local branch of this ticket and it has proved super useful.

Changed 7 years ago by Arthur Koziel

Added app completion for some commands

comment:9 Changed 7 years ago by jkocherhans

Resolution: fixed
Status: newclosed

(In [11526]) Fixed #10752. Added more advanced bash completion. Thanks, Arthur Koziel.

comment:10 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top