move argument validation to the parser
This commit is contained in:
parent
b3188d17fc
commit
e230a80be1
45
urchin
45
urchin
@ -653,32 +653,25 @@ you don't need to quote the TEST_SHELL variable." >&2
|
|||||||
urchin_exit;;
|
urchin_exit;;
|
||||||
-*) urchin_help >&2
|
-*) urchin_help >&2
|
||||||
urchin_exit 11;;
|
urchin_exit 11;;
|
||||||
*) validate_strings "${1}" 'Test file names'
|
*) if contains "${1}" "${DELIMITERS}"; then
|
||||||
validate_test_arg "${1}"
|
echo 'Test file names may not contain delimiter characters.' >&2
|
||||||
validate_test_arg() {
|
urchin_exit 11
|
||||||
# Must be a file or directory
|
elif [ ! -e "${1}" ]; then
|
||||||
if [ ! -e "${1}" ]; then
|
echo "No such file or directory: '${1}'" >&2
|
||||||
echo "No such file or directory: '${1}'" >&2
|
echo "${USAGE}" >&2
|
||||||
echo "${USAGE}" >&2
|
urchin_exit 11
|
||||||
urchin_exit 11
|
elif ! {
|
||||||
fi
|
# Molly guard
|
||||||
|
root="$(urchin_root "${1}")"
|
||||||
# Molly guard
|
basename "$(fullpath "${root}")" |
|
||||||
root="$(urchin_root "${1}")"
|
grep -i 'test' > /dev/null || "${force}"
|
||||||
if ! {
|
}; then
|
||||||
basename "$(fullpath "${root}")" |
|
echo 'The root directory of the tests that you are running urchin on
|
||||||
grep -i 'test' > /dev/null || "${force}"
|
does not contain the word "test", so I am not running,
|
||||||
}; then
|
in case that was an accident. Use the -f flag if you really
|
||||||
echo 'The root directory of the tests that you are running urchin on
|
want to run urchin on that directory.' >&2
|
||||||
does not contain the word "test", so I am not running,
|
urchin_exit 12
|
||||||
in case that was an accident. Use the -f flag if you really
|
fi
|
||||||
want to run urchin on that directory.' >&2
|
|
||||||
urchin_exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "${1}" >> "${test_arg_list}" ;;
|
echo "${1}" >> "${test_arg_list}" ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
Loading…
Reference in New Issue
Block a user