Hey, I'm trying to get zsh to run the git command and use the output to generate autocomplete capabilities.
The command I'm trying to run is
git log -n 2 --pretty=format:"'%h %an'"
And here is the code I'm using:
local lines words
lines=(${(f)$(git log -n 2 --pretty=format:"'%h %an'")})
words=${(f)$(_call_program foobar git log -n 2 --pretty=format:"%h")}
echo "Length of lines is " ${
echo "Length of words is " ${
compadd -d lines -a -- words
This does not work at all ... he thinks that wordsthis is the only element and the lines do not get the proper print.
However, when I try to adjust the string array manually, it all works.
local lines words
lines=('one two' 'three')
words=('one two' 'three')
echo "Length of lines is " ${#lines[@]} " value is " ${lines}
echo "Length of words is " ${#words[@]} " value is " ${words}
compadd -d lines -a -- words
source
share