feature request on ppa-name bash-completion

Bug #1064205 reported by funicorn
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
ppa-purge (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I hope ppa-purge could introduce bash-completion for ppa names. I don't know others, but for me it's badly inconvenient. For many times have I input the wrong name, for many times have I googled to confirm the right name, and for many times have I input a correct name and wait for long only to find out the ppa has been disabled in the sources.list. Hence it would be necessary to introduce bash-completion to auto fill the name form.

Here is a basic bash-completion example for listing the 'meta' names located in /etc/apt/sources.list.d and triggering completion prompt based on user input. For example, if user(me) input something like 'xorg', it gives 'xorg-edgers-ppa-quantal'. Hence he(me) can guess the right name is 'xorg-edgers/ppa'. And by the way the disabled ppa lists are screened out before this completion.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# /usr/share/bash-completion/completions/ppa-purge
# Debian ppa-purge(1) completion -*- shell-script -*-

_ppa_purge(){
    local cur
    _init_completion || return

 local list=( $( find /etc/apt/sources.list.d/ -name "*.list" -exec basename {} \; | command sed 's/\.list$//g' 2> /dev/null ) )
 local i=0
 local wc=${#list[@]}
 while [[ $i -lt $wc ]]
  do
   if ! grep -Ev ^# "/etc/apt/sources.list.d/${list[$i]}.list" >/dev/null; then
    unset list[$i]
   fi
   let i++
  done

 COMPREPLY=( $( compgen -W '${list[@]}' -- "$cur" ) )

    return 0
} &&
complete -F _ppa_purge ppa-purge
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Note It cannot work directly since it has to include the arguments used as 'prefix', which however is quite straightforward to work around. And the reply message could be sourced from the .list file instead of the filename and further divided into ppa name and team name , which is quite straightforward too. It's also an option to designate a separate argument for ppa-purge to include this completion feature.

Related branches

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ppa-purge (Ubuntu):
status: New → Confirmed
Revision history for this message
Tim Lunn (darkxst) wrote :

I have linked my bash auto-completion branch.

few minor points:
1. added new option -o to specify ppa owner
2. had to drop the "ppa:" prefix since ":" are a pain in the ass when it comes to autocompletion.

That said it is still compatible with the previous usage, just wont work with auto-completion

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ppa-purge - 0.2.8+bzr63

---------------
ppa-purge (0.2.8+bzr63) xenial; urgency=low

  * Add bash autocompletion and tweak options slightly. (LP: #1064205)
  * Specify removal of packages that don't exist in Ubuntu (LP: #706774)
  * Add some logic to handle packages that have had a soname bump, packages with
    manual renames will still break, however these should be pretty rare. (LP: #1392954)
  * Add Vcs-fields, Thanks Dominique Lasserre

 -- Tim Lunn <email address hidden> Fri, 30 Nov 2012 08:25:57 +1100

Changed in ppa-purge (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Jarno Suni (jarnos) wrote :

Unfortunately the fix is not available in 14.04.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.