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

Re: completion within a function



On 2020-12-29 1:04 p.m., Ray Andrews wrote:


I presume Ray wants something like "complete ma", which would return
"make man ..." essentially everything that typing "ma<tab>" would
return.

Yeah, just that Filipe.


This snippet pretty well does it, mind I'm still interested in trying to use completion:
    {
        local dirs=( $1*(N) )

        for ((aa = 1; aa <= $#dirs; aa++)); do
            ! [ -d "$dirs[$aa]" ] && dirs[$aa]=''
        done

        dirs=($dirs) #How do folks survive who don't know this?
        [ "$#dirs" -eq 1 ] && cd "$dirs[1]"
        # else, fall through to n_list():
    }






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