I'd like my function to display help information if there are no arguments, or if the first argument is either -h or --help.
function foo
if test -z "$argv" -o "$argv[ 1 ]" = "-h" -o "$argv[ 1 ]" = "--help"
echo "help"
# Else if there are other arguments, do something else...
end
end
This seems to work correctly when there are no arguments, or if the first argument is --help, but sending -h returns an error:
test: Expected a combining operator like '-a' at index 5
I'm running fish on Fedora 22 x64. I've tried this on both the version available in the Fedora repos (2.1.1) and from compiling the latest release (2.2.0).
I'd like my function to display help information if there are no arguments, or if the first argument is either
-hor--help.This seems to work correctly when there are no arguments, or if the first argument is
--help, but sending-hreturns an error:I'm running fish on Fedora 22 x64. I've tried this on both the version available in the Fedora repos (2.1.1) and from compiling the latest release (2.2.0).