Bash Tab Completion and command-not-found enhancements

Registered by Clint Byrum on 2010-10-15

Bash tab completion can make esoteric, complicated commandline programs much easier to use, but it must be consistent. Currently Ubuntu has a lot of tab completion enabled, but some commands are inconsistent with others. On the same vein, there are a lot of little things that can be done with command-not-found that will make it even better at helping users find the best program, not just a program.

Blueprint information

Status:
Not started
Approver:
Robbie Williamson
Priority:
Low
Drafter:
Clint Byrum
Direction:
Approved
Assignee:
Clint Byrum
Definition:
Approved
Series goal:
Accepted for natty
Implementation:
Deferred
Milestone target:
milestone icon ubuntu-11.04-beta-1

Whiteboard

Status: After discovering bug #533985 and developing a fix for it, I think this is actually a giant leap forward for bash completion. Most of the packages noted make use of the _filedir whitelisting, which has been the biggest source of annoyance for me. Also the command not found enhancements have had to be dropped as time has run short.

Work Items:
Identify all packages with bash tab completion (See bottom of whiteboard for comprehensive list): DONE
Write test script to assess consistency of existing bash tab completion: POSTPONED
Run test script against all existing tab completion scripts: POSTPONED
File bugs for gross inconsistencies found by test script: POSTPONED
File bugs for gross inconsistencies found by cursory examination: DONE
Write best practices for bash tab completion: POSTPONED
Publicize best practices for bash tab completion: POSTPONED
Investigate apport hook on tab-completion-fail: POSTPONED
Write apport hook for bash tab completion: POSTPONED
Create list of known preferred commands for command-not-found: POSTPONED
Contact ubuntu-server and ubuntu-devel for known preferences/deprecations: POSTPONED
Add preferred commands into command-not-found: POSTPONED

Gobby Document from UDS Session:

Main topics:
 - bash argument completion
   - lack of consistency (sqlite doesn't let you complete database files)
 - command-not-found

Clint: Bash tab completion unpredictable, handled differently by each different program

Emmitt: Suggested work items around bash-completion
 1) identify packages without completion information
 2) review current ones and make sure they're accurate
 3) file bugs accordingly
 4) Investigate Apport Integration

 * Command not found
  - Only "arch: any" packages included
    ZygmuntKrynicki: This is not true, try 'wine' which is i386 only for example
    # Built from a single archive file manually
    ZygmuntKrynicki: ?
  - should command-not-found prioritize its output (see Bug: #508606)? consensus:
  - support arbitrary hints
  - ACTION: set opinionated defaults for the server seed (put in a special package)
  - ACTION: modify command-not-found to use ^
  - ACTION: publicize this capability to ubuntu / debian developers

Original whiteboard:
10.15.2010 - Changed the link name as this can sit in the System Defaults portion of the "Package Selection and System Defaults" track

10.20.2010 - Proposed subject of discussion: use of tab auto-completion on bash aliases. (DB)

Kirkland:
 * I would like to have an almost "conversational" search interface for users on a command line. I've been toying with the idea of a tool called /usr/bin/q -- sort of a unified search utility. You'd type "q <whatever>", and hit enter. This would then use a series of tools (command-not-found, apt-cache, locate, apropos, etc) to find a few pertinent hits for whatever the search terms are. I have a working prototype, that I'll demo, if you like.

ZygmuntKrynicki: I think that a "talking to computer" approach for command line is pointless as that's not what good user interface is about. The command line is _not_ designed for users but for engineers, developers and administrators. Trying to "hold the hand" of regular users in command line is like trying to make spotting mines easier for tourists that visit mine fields. It's an attempt to solve the wrong problem. I think we should focus on giving the people that do use the command line something better _without_ reinventing/throwing the command line paradigm.

Having said that I would love to see some deeper integration between the shell, the web, the software center and the community. There are some amazing data mining/suggestion possibilities there. IMHO doing that kind of integration would be a major landmark for Ubuntu.

In addition to that I'd encourage pure technical improvements to how the current code works (especially performance)

ZygmuntKrynicki: One interesting possibility (I'm not sure if that's what you had on mind) would be to tab-complete uninstalled commands. This is doable in several different ways (bash hooks, fuse fs, dpkg triggers).

All packages in natty as of 3/17/2011 that have a file in /etc/bash_completion.d (as found w/ apt-file):

ack-grep
alltray
apache2.2-common
apport
apt-file
apt-show-versions
apt-xapian-index
atool
bash-completion
bins
blazeblogger
boinc-client
bti
bzr
cabal-install
calibre
cdcd
cil
coccinelle
code-saturne-data
cowbuilder
cupt
darcs
dbs
debconf
debfoster
deborphan
debtags
desktop-file-utils
devscripts
devtodo
ditz
dkms
dlocate
dpatch
dput
drbd8-utils
easygit
emdebian-crush
emdebian-grip
emdebian-tdeb
epix
etckeeper
eucalyptus-common
gammu
ganeti2
git
git-buildpackage
gmic
griffith
grub-common
gvfs-bin
haxe
ifscheme
initramfs-tools
inkscape
insserv
jackd1
jackd2
kalign
kdocker
kernel-package
konwert
langupdate
libconfig-model-perl
libdist-zilla-perl
libjifty-perl
libmuroar0
libreoffice-common
libruby1.9.1
linkchecker
lyx-common
maven2
mercurial
moap
module-assistant
monotone
moosic
morituri
mtx
multistrap
nanoblogger-extra
ncmpcpp
nmh
nodejs-dev
notmuch
nut
ocaml-findlib
oggz-tools
opennebula
openvpn
osynctool
packagekit-bash-completion
pbuilder
pcp
phoronix-test-suite
pilot-qof
pmount
powerwake
ppp
publican
python-django
python-optcomplete
python-pastescript
python-pygments
python-scrapy
qemubuilder
quickly
quilt
rake
rant
rasmol
r-base-core
rdiff-backup
redis-server
reprepro
rinse
roaraudio
rubygems1.8
scenic-utils
schroot
scilab-cli
source-highlight
stgit
subversion
surfraw
svn-buildpackage
task
thinkfinger-tools
tig
topgit
ubuntu-dev-tools
ufw
unison
unison2.27.57
unison2.27.57-gtk
unison-gtk
unp
upstart
util-vserver
valgrind
vim-addon-manager
virtualenvwrapper
vzctl
wajig
xxdiff-scripts
zeitgeist-core
zfs-fuse
zope-common

(?)

Work Items