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

Re: [PATCH] completion: add _uids, _gids



dana wrote on Fri, 10 Jul 2026 02:40 +00:00:
> +++ b/Completion/Unix/Type/_gids
> @@ -0,0 +1,21 @@
> +#autoload
> +
> +# see _uids
> +
> +local -a match mbegin mend gids disp inst cmd=( getent group )
> +
> +(( $+commands[getent] )) || cmd=( cat /etc/group )
> +
> +[[ $OSTYPE == darwin* ]] && gids=( ${${(f)"$(
> +  _call_program dscl-list dscl . -list /Groups PrimaryGroupID
> +)"}/#(#b)([^ ]##)[ ]##(-#<->)*/$match[2]:$match[1]} )
> +
> +(( $#gids )) || {

Consider changing this to «(( $+gids[1] ))», which is equivalent logically but takes O(1) to compute?

Ditto in _uids.

Cheers,

Daniel




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