FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 06-11-2010, 09:48 AM
David Paleino
 
Default Bug#537139: Bug#537139: initramfs-tools: please include update-initramfs bash completion

On Tue, 8 Jun 2010 14:42:07 +0200, Michael Prokop wrote:

> Hi,

Hello,

> dear Bash Completion Maintainers, can you please check out the
> attached bash completion (#537139)? I'm not a bash user and can't
> judge whether that's the way to go or anything should be changed.

Sure:

> > --------------------------------------------------
> > # update-initramfs(8) completion
> > # provided by Stéphane (kwisatz) Jourdois <stephane@jourdois.fr>
> >
> > _update_initramfs()
> > {
> > local cur prev valid_options
> >
> > cur=`_get_cword`
> > prev=${COMP_WORDS[COMP_CWORD-1]}
> >
> > # The only option that takes an argument is -k
> > if [[ "$prev" == '-k' ]]; then
> > # Complete with kernel versions
> > _kernel_versions
> > return;
> > fi
> >
> > # Complete with available options (obtained from -h)
> > valid_options=$( update-initramfs -h 2>&1 |
> > sed -e '/^ -/!d;s/^ (-w+).*/1/' )
> > COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) )
> > }
> > complete -F _update_initramfs update-initramfs
> > --------------------------------------------------

The only "suggestion" I can give is to also add "all" to the completion of "-k".
You can achieve this by adding, after _kernel_versions:

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

This way you add "all" to the list of completions given by "_kernel_versions".
Other than this, it seems quite fine to me.

However, we're going to release bash-completion 1.2 very soon (probably this
week-end) -- in that case, you can also change the initial lines, from:

cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}

to:

_get_comp_words_by_ref cur prev

Remember that this will be available only on >= 1.2. So, depending on when
you're going to upload it, you might want to use one of those versions.

> Should we add this to package initramfs-tools or would you mind
> adding it to bash-completion?

Please add it to your package, and install it using dh_bash-completion(1) if
you can

Kindly,
David

--
. '`. Debian developer | http://wiki.debian.org/DavidPaleino
: :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
`. `'` GPG: 1392B174 ----|---- http://deb.li/dapal
`- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
 

Thread Tools




All times are GMT. The time now is 06:16 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org