help output
This commit is contained in:
parent
1a5360551e
commit
51ebc2570d
41
mdcheckr
41
mdcheckr
|
@ -224,10 +224,17 @@ function explain() {
|
||||||
>&2 echo -e Warning:$_file:$_line_no:$_message
|
>&2 echo -e Warning:$_file:$_line_no:$_message
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse command-line optins
|
# Parse command-line optins...
|
||||||
function show_help() {
|
function show_usage() {
|
||||||
|
cat << EOF
|
||||||
|
usage: mdcheckr [ -h | --help | -v | --version ] FILE ..
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function show_help() {
|
||||||
|
show_usage
|
||||||
cat << EOF
|
cat << EOF
|
||||||
usage: mdcheckr [ -h ] FILE ..
|
|
||||||
|
|
||||||
A testing tool to detect quality problems with your Markdown documentation.
|
A testing tool to detect quality problems with your Markdown documentation.
|
||||||
|
|
||||||
|
@ -248,8 +255,25 @@ function show_version() {
|
||||||
VERSION="1.0"
|
VERSION="1.0"
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
VERBOSITY=3
|
VERBOSITY=3
|
||||||
while getopts hv opt; do
|
while getopts "hv-:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
-)
|
||||||
|
case "${OPTARG}" in
|
||||||
|
help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
version)
|
||||||
|
show_version
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0: Illegal option -- ${OPTARG}" >&2
|
||||||
|
show_usage >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -259,13 +283,20 @@ while getopts hv opt; do
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
show_help >&2
|
show_usage >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
|
# Require at least one filename to be specified
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
echo "$0: Missing file operand" >&2
|
||||||
|
show_usage >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Explicitly check for each dependency
|
# Explicitly check for each dependency
|
||||||
for i in which pandoc xmllint curl; do which $i > /dev/null 2> /dev/null || (
|
for i in which pandoc xmllint curl; do which $i > /dev/null 2> /dev/null || (
|
||||||
>&2 echo "The tool '$i' is required by mdcheckr, but is not in your \$PATH."
|
>&2 echo "The tool '$i' is required by mdcheckr, but is not in your \$PATH."
|
||||||
|
|
Loading…
Reference in New Issue