scripts: dev_cli.sh: print help if command unspecified

To improve user friendliness, print help text when no command is given.

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
This commit is contained in:
Ruslan Mstoi 2023-02-16 17:45:45 +02:00 committed by Bo Chen
parent 996bdc6e08
commit 2e94a86b31

View File

@ -168,6 +168,7 @@ process_volumes_args() {
exported_volumes="$exported_volumes --volume $var" exported_volumes="$exported_volumes --volume $var"
done done
} }
cmd_help() { cmd_help() {
echo "" echo ""
echo "Cloud Hypervisor $(basename "$0")" echo "Cloud Hypervisor $(basename "$0")"
@ -625,6 +626,12 @@ cmd_shell() {
fix_dir_perms $? fix_dir_perms $?
} }
if [ $# = 0 ]; then
cmd_help
say_err "Please specify command to run!"
exit 1
fi
# Parse main command line args. # Parse main command line args.
# #
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do