Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: which completion function are used for aliases?



Andy Spiegl wrote:
> Now, is it also possible to make zsh "know" the options of the alias,
> so that I don't have to hardcode the aliases in my completion function?
> 
> But how can I get the details of the defined aliases???
> 
> # Default directories (depending on which alias is used)
> if [[ -z $dir ]]; then
>   if [[ $words[1] = gigaset2 ]]; then
>     dir="/home/spiegl/movies/gigaset/PVR/"
>   elif [[ $words[1] = gigaset3 ]]; then
>     dir="/data2/movies/gigaset/PVR/"
>   elif [[ $words[1] = gigaset-ext ]]; then
>     dir="/extern-dos/Video/"
>   else
>     dir="/data/movies/gigaset/PVR/"
>   fi
> fi
> 
> PS:
>  gigaset2='gigaset --dir /home/spiegl/movies/gigaset/PVR'
>  gigaset3='gigaset --dir /data2/movies/gigaset/PVR'
>  gigaset-ext='gigaset --dir /extern-dos/Video'

if [[ $aliases[$words[1]] = *" --dir "* ]]; then
   dir=${aliases[$words[1]]##*--dir }
fi

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



Messages sorted by: Reverse Date, Date, Thread, Author