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

Re: completions issues



On Jul 13,  9:37pm, GoTaR wrote:
} Subject: Re: completions issues
}
} _sms_aliases () {
}         smsas=(`smsaddr -l | perl -ne 's/		/:/; if
} (/^'$PREFIX'/) {print} else {if (/:'$PREFIX'/) {/^(.*):(.*)$/; print
} "$2:$1\n"}}'`)
}         _describe "SMS alias" "smsas"
} }
} 
} And question: how to make it without perl?

  _sms_aliases () {
    smsas=( ${(f)$(smsaddr -l)} )
    smsas=( ${smsas/		/:}
	    ${smsas/(#s)(#b)(*)		(*)(#e)/$match[2]:$match[1]} )
    smsas=( ${(M)smsas:#$PREFIX*} )
    _describe "SMS alias" smsas
  }

I don't think you even need that last smsas= that matches against $PREFIX,
as the completion internals should take care of filtering the possible
matches generated by _sms_aliases against the actual input on the line.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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