Public bug reported:

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.

** Affects: ppa-purge (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: bash-completion

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1064205

Title:
  feature request on ppa-name bash-completion

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ppa-purge/+bug/1064205/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to