Display help message if mandatory arguments are missing
This commit is contained in:
parent
1cbb982d02
commit
807dd44408
|
@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* Display help message if mandatory arguments are missing.
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
17
bkctld
17
bkctld
|
@ -52,17 +52,30 @@ case "${subcommand}" in
|
||||||
;;
|
;;
|
||||||
"init" | "is-on")
|
"init" | "is-on")
|
||||||
jail_name="${2:-}"
|
jail_name="${2:-}"
|
||||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
if [ -z "${jail_name}" ]; then
|
||||||
|
"${LIBDIR}/bkctld-help"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
"key" | "port" | "ip")
|
"key" | "port" | "ip")
|
||||||
jail_name="${2:-}"
|
jail_name="${2:-}"
|
||||||
option="${3:-}"
|
option="${3:-}"
|
||||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}" "${option}"
|
if [ "${jail_name}" = "all" ] || [ -z "${jail_name}" ]; then
|
||||||
|
"${LIBDIR}/bkctld-help"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}" "${option}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall")
|
"start" | "stop" | "reload" | "restart" | "sync" | "update" | "remove" | "firewall")
|
||||||
jail_name="${2:-}"
|
jail_name="${2:-}"
|
||||||
if [ "${jail_name}" = "all" ]; then
|
if [ "${jail_name}" = "all" ]; then
|
||||||
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}"
|
"${LIBDIR}/bkctld-list" | xargs --no-run-if-empty --max-args=1 --max-procs=0 "${LIBDIR}/bkctld-${subcommand}"
|
||||||
|
elif [ -z "${jail_name}" ]; then
|
||||||
|
"${LIBDIR}/bkctld-help"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue