diff options
-rwxr-xr-x | kvmx | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -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 <action> [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 <machine> [folder]" - echo "$BASENAME clone <orig-guest> <dest-folder>" + echo -e "\t$BASENAME list" + echo -e "\t$BASENAME init <machine> [folder]" + echo -e "\t$BASENAME clone <orig-guest> <dest-folder>" + echo "" + + local list="`kvmx_list | xargs`" + + if [ ! -z "$list" ]; then + echo "available virtual machines:" + echo "" + echo -e "\t$list" + echo "" + fi exit 1 } |