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

Re: Suggestion: chmod +x auto completion only completes files that do not have executable permission



On 05/22/2012 12:19 AM, Bart Schaefer wrote:
On May 18,  4:56pm, Hong Xu wrote:
}
} I have a suggestion about chmod auto completion here. We could
} complete only chmod +x with files that do not have executable
} permission, and vice versa. We could also apply this rule to chmod +r,
} chmod +w, etc. What do you think?

As far as I can tell, chmod completion already does this.  _chmod has
this snippet:

     for spec in ${(s:,:)words[2]}
     do
	if [[ ${spec#*[+-=]} != [rwxst]## ]]
	then
	    _files&&  ret=0
	    return ret
	fi
	specs+=(${${(M)spec##[+-=]*}:+a}$spec)
     done
     _wanted files expl file _files -g "*(-.^f:${(j.,.)specs}:)"&&  ret=0

Do you have a case where it's failing?

Weird, now it works for me like a charm. Thanks anyway!


Hong



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