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
|
||||
|
||||
* Display help message if mandatory arguments are missing.
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
|
17
bkctld
17
bkctld
|
@ -52,17 +52,30 @@ case "${subcommand}" in
|
|||
;;
|
||||
"init" | "is-on")
|
||||
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")
|
||||
jail_name="${2:-}"
|
||||
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")
|
||||
jail_name="${2:-}"
|
||||
if [ "${jail_name}" = "all" ]; then
|
||||
"${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
|
||||
"${LIBDIR}/bkctld-${subcommand}" "${jail_name}"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue