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

David Lutterkort dlutter at redhat.com
Fri Jul 25 20:27:34 UTC 2008


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' ?

> +
> +[ "${have:-}" ] && complete -F _augtool $filenames augtool

>From looking at my /etc/bash_completion, it looks like this line should
be

        have augtool && complete -F _augtool $filenames augtool
        
David





More information about the augeas-devel mailing list