[augeas-devel] Re: [PATCH] Add bash_completion script for augtool

Raphaël Pinson raphink at gmail.com
Sat Jul 26 10:32:35 UTC 2008


On Fri, Jul 25, 2008 at 10:27 PM, David Lutterkort <dlutter at redhat.com>wrote:

> On Thu, 2008-07-24 at 17:04 +0200, raphink at gmail.com wrote:
> > # HG changeset patch
> > # User Raphael Pinson <raphink at gmail.com>
> > # Date 1216911887 -7200
> > # Node ID 26d9cf6f08a155818cab92eb1275a932a017d19b
> > # Parent  ae394e5c16338ed8622274199c4ad5900fff20b8
> > Add bash_completion script for augtool
>
> Nice.
>
> > diff -r ae394e5c1633 -r 26d9cf6f08a1 augeas.bash_completion
> > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> > +++ b/augeas.bash_completion  Thu Jul 24 17:04:47 2008 +0200
>
> > +              case $cur in
> > +                 /augeas*)
> > +                       files=$( find ${rootdir}/${cur##/augeas}*
>  -maxdepth 1 2>/dev/null | sed -e "s@^${rootdir}@/augeas at g" | sed -re "s@/+@/@g"
> )
> > +                    COMPREPLY=( $( compgen -W "${files}" -- $cur ) )
> > +                    ;;
> > +                 /files*)
> > +                       files=$( find ${rootdir}/${cur##/files}*
>  -maxdepth 1 2>/dev/null | sed -e "s@^${rootdir}@/files at g" | sed -re "s@/+@/@g"
> )
> > +                    COMPREPLY=( $( compgen -W "${files}" -- "$cur" ) )
> > +                    ;;
>
> This doesn't seem right to me .. why do you look into the filesystem for
> possible completions ? Shouldn't you complete on the output of 'augtool
> ls $cur' ?
>

That's what I would do indeed, if augtool was reactive enough. Since augtool
takes at least 3 secondes on each request (it's not even an issue with my
machine, since I develop on a dual-core amd64 with 4GB RAM server), I
thought I would just use the filesystem to complete instead of augtool
itself.




Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080726/5efefc96/attachment.htm>


More information about the augeas-devel mailing list