Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10752 closed (fixed)

Advanced Bash Completion

Reported by: arthurk Owned by: arthurk
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 arthurk 5 years ago.
django_bash_completion.2.diff (9.3 KB) - added by arthurk 5 years ago.
django_bash_completion.3.diff (9.1 KB) - added by arthurk 5 years ago.
added "-o default" back in
django_bash_completion.4.diff (9.6 KB) - added by arthurk 5 years ago.
Added app completion for some commands

Download all attachments as: .zip

Change History (14)

Changed 5 years ago by arthurk

comment:1 Changed 5 years ago by jezdez

  • Component changed from Uncategorized to django-admin.py
  • milestone changed from 1.2 to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by jezdez

  • Needs documentation set

comment:3 Changed 5 years ago by flosch

  • Cc flosch@… added

comment:4 Changed 5 years ago by jacob

  • milestone changed from 1.1 to 1.2

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

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

Changed 5 years ago by arthurk

comment:6 Changed 5 years ago by arthurk

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

comment:7 Changed 5 years ago by arthurk

  • Owner changed from nobody to arthurk

Changed 5 years ago by arthurk

added "-o default" back in

comment:8 Changed 5 years ago by ericholscher

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

Changed 5 years ago by arthurk

Added app completion for some commands

comment:9 Changed 5 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:10 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.