Comment 4 for bug 1221503

Revision history for this message
Peter Cordes (peter-cordes) wrote :

attaching a patch. I think I tested everything I changed. I replaced the loop over ls output with grep -l | sed.

I made a bunch of overall changes and improvements to the script, too.

When completing an empty word, instead of returning the full list of all available packages, all PIDs, and all files in the current directory, list just symptoms and made-up stand-in describing what arguments it accepts

Completion doesn't list short options, just the long-option version. If you don't know what option you want, a letter doesn't tell you anything.

$ apport-bug [TAB]
audio dist-upgrade storage
#buggy-file# --help --tag
#buggy-package# release-upgrade ubuntu-release-upgrader
#buggy-process-id# --save --version
display security --window

 File and directory completion via _filedir, compopt -o dirnames fallback, or complete -f -d, never via complete -G "$cur*" or anything similarly horrible that will break with spaces in filenames.

 Also tidied up the functions. I think the point of some code duplication was to special-case completing the bare command, and only list --help and --version if we were completing the first argument. (which was kind of moot when completion output also included something like 40k package names...) Could still do that by checking $cword.