From eb13690042fd1cff11e1918f421c0dbf1b0ef37a Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 10 Mar 2017 14:11:06 -0300 Subject: Enhanced usage --- kvmx | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/kvmx b/kvmx index 95873dc..6fd328d 100755 --- a/kvmx +++ b/kvmx @@ -118,13 +118,29 @@ function kvmx_up { # Display usage function kvmx_usage { - echo "$BASENAME $VERSION" + echo "$BASENAME $VERSION - virtual machine manager" + echo "" echo "usage: $BASENAME [options]" + echo "" + echo "available actions:" + echo "" + grep "^function kvmx_" $0 | cut -d ' ' -f 2 | sed -e 's/kvmx_/\t/' + echo "" echo "examples:" echo "" - echo "$BASENAME list" - echo "$BASENAME init [folder]" - echo "$BASENAME clone " + echo -e "\t$BASENAME list" + echo -e "\t$BASENAME init [folder]" + echo -e "\t$BASENAME clone " + echo "" + + local list="`kvmx_list | xargs`" + + if [ ! -z "$list" ]; then + echo "available virtual machines:" + echo "" + echo -e "\t$list" + echo "" + fi exit 1 } -- cgit v1.2.3