You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fisher/test/help-parse.fish

25 lines
701 B
Fish

function -S setup
function foo
printf "%s\n" "usage: foo [options] ..."
printf "%s\n" "options:"
printf "%s\n" " --version Show version"
printf "%s\n" " -h --help Show help"
end
end
function -S teardown
functions -e foo
end
test "$TESTNAME - Parse single long option with description"
(foo | __fisher_help_parse | sed -n 1p) = "Show version;version;"
end
test "$TESTNAME - Parse short and long option with description "
(foo | __fisher_help_parse | sed -n 2p) = "Show help;help;h"
end
test "$TESTNAME - Ignore non-option info, e.g, usage:, options:, etc."
(foo | __fisher_help_parse | xargs) = "Show version;version; Show help;help;h"
end