I was reading the git.fish completion script (/usr/local/Cellar/fish/2.1.2/share/fish/completions) for fish shell and I ran into some problems with understanding what the syntax means.
In the block,
function __fish_git_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'git' ]
return 0
end
return 1
end
I understand that cmd
is set as commandline -opc
. But in the next statement (count $cmd) -eq 1 -a $cmd[1] = 'git'
, what do -eq
and -a
mean?
I am new to fish shell and I am trying to understand the syntax by trying to write my own completion script for a program. Help would be greatly appreciated.
Thank you.