Bug#747094: Updated Patch
On Wed, Sep 09, 2015 at 10:58:37AM +0200, Stefano Zacchiroli wrote: > On Wed, Sep 09, 2015 at 10:56:21AM +0200, Stefano Zacchiroli wrote: > > Thanks for your patch! I've now rebuilt a local bash-completion that > > uses it, and it's just great. > > BTW, why is this patch number 14 in the series rather than 13? I just kept the same patch number Michael had used when he created the initial fix. https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/bash-completion/wily/revision/48 > I thought that was because another patch numbered 13 was in the series > on the Ubuntu side, but according to > https://patches.ubuntu.com/b/bash-completion/bash-completion_1:2.1-4.1ubuntu2.patch > that doesn't seem to be the case. > > Not that I care *that* much :), I'm just trying to figure out whether > some other patches from Ubuntu should be integrated or not. There is not a number 13 patch. -- Brian Murray signature.asc Description: Digital signature
Bug#747094: Updated Patch
On Wed, Sep 09, 2015 at 10:56:21AM +0200, Stefano Zacchiroli wrote: > Thanks for your patch! I've now rebuilt a local bash-completion that > uses it, and it's just great. BTW, why is this patch number 14 in the series rather than 13? I thought that was because another patch numbered 13 was in the series on the Ubuntu side, but according to https://patches.ubuntu.com/b/bash-completion/bash-completion_1:2.1-4.1ubuntu2.patch that doesn't seem to be the case. Not that I care *that* much :), I'm just trying to figure out whether some other patches from Ubuntu should be integrated or not. TIA, Cheers. -- Stefano Zacchiroli . . . . . . . z...@upsilon.cc . . . . o . . . o . o Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o Former Debian Project Leader . . . . . @zacchiro . . . . o o o . . . o . « the first rule of tautology club is the first rule of tautology club » signature.asc Description: Digital signature
Bug#747094: Updated Patch
On Thu, Aug 13, 2015 at 09:31:57AM -0700, Brian Murray wrote: > Michael's patch was actually incomplete, I'm attaching an updated > version which completely adds apt support and is now in Ubuntu. Thanks for your patch! I've now rebuilt a local bash-completion that uses it, and it's just great. Small feature request: "apt install" can now (with the version of apt in experimental, at least) install local .deb packages, and resolve dependencies as needed. So it'd be nice if "apt install " would also complete with local *.deb files on the filesystem. Do you think you can add that? FWIW, I'm considering NMU-ing to DELAYED/XX bash-completion to fix this specific bug, as I think it'd help quite a bit with the adoption of the new apt command. (But, anyone, feel free to beat me at it!) Cheers. -- Stefano Zacchiroli . . . . . . . z...@upsilon.cc . . . . o . . . o . o Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o Former Debian Project Leader . . . . . @zacchiro . . . . o o o . . . o . « the first rule of tautology club is the first rule of tautology club » signature.asc Description: Digital signature
Bug#747094: Updated Patch
Michael's patch was actually incomplete, I'm attaching an updated version which completely adds apt support and is now in Ubuntu. -- Brian Murray ## Description: add bash completion support for the new "apt" command ## Origin/Author: Michael Vogt ## Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747094 Index: wily/completions/apt === --- /dev/null +++ wily/completions/apt @@ -0,0 +1,95 @@ +# Debian apt(8) completion -*- shell-script -*- + +_apt() +{ +local sourcesdir="/etc/apt/sources.list.d" +local cur prev words cword +_init_completion || return + +# see if the user selected a command already +local COMMANDS=("install" "remove" "purge" "show" "list" +"update" "upgrade" "full-upgrade" "dist-upgrade" +"edit-sources" "help") + +local command i +for (( i=0; i < ${#words[@]}-1; i++ )); do +if [[ ${COMMANDS[@]} =~ ${words[i]} ]]; then +command=${words[i]} +break +fi +done + +# supported options per command +if [[ "$cur" == -* ]]; then +case $command in +install|remove|purge|upgrade|full-upgrade) +COMPREPLY=( $( compgen -W '--show-progress + --fix-broken --purge --verbose-versions --auto-remove + --simulate --dry-run + --download + --fix-missing + --fix-policy + --ignore-hold + --force-yes + --trivial-only + --reinstall --solver' -- "$cur" ) ) +return 0 +;; +update) +COMPREPLY=( $( compgen -W '--list-cleanup + ' -- "$cur" ) ) +return 0 +;; +list) +COMPREPLY=( $( compgen -W '--installed --upgradable + --manual-installed + -v --verbose + -a --all-versions + ' -- "$cur" ) ) +return 0 +;; +show) +COMPREPLY=( $( compgen -W '-a --all-versions + ' -- "$cur" ) ) +return 0 +;; +esac +fi + +# specific command arguments +if [[ -n $command ]]; then +case $command in +remove|purge) +if [[ -f /etc/debian_version ]]; then +# Debian system +COMPREPLY=( $( \ +_xfunc dpkg _comp_dpkg_installed_packages $cur ) ) +else +# assume RPM based +_xfunc rpm _rpm_installed_packages +fi +return 0 +;; +install|show|list) +COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \ +2> /dev/null ) ) +return 0 +;; +edit-sources) +COMPREPLY=( $( compgen -W '$( command ls $sourcesdir )' \ +-- "$cur" ) ) +return 0 +;; +esac +fi + +# no command yet, show what commands we have +if [ "$command" = "" ]; then +COMPREPLY=( $( compgen -W '${COMMANDS[@]}' -- "$cur" ) ) +fi + +return 0 +} && +complete -F _apt apt + +# ex: ts=4 sw=4 et filetype=sh Index: wily/completions/Makefile.am === --- wily.orig/completions/Makefile.am +++ wily/completions/Makefile.am @@ -7,6 +7,7 @@ bashcomp_DATA = a2x \ alias \ ant \ apache2ctl \ + apt \ apt-build \ apt-cache \ apt-get \ Index: wily/completions/Makefile.in === --- wily.orig/completions/Makefile.in +++ wily/completions/Makefile.in @@ -178,6 +178,7 @@ bashcomp_DATA = a2x \ alias \ ant \ apache2ctl \ + apt \ apt-build \ apt-cache \ apt-get \ signature.asc Description: Digital signature