diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-10 14:11:06 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-10 14:11:06 -0300 |
commit | eb13690042fd1cff11e1918f421c0dbf1b0ef37a (patch) | |
tree | 8de95d4756ae1f0cfe72e8686436fcc3e72809a1 | |
parent | d3b73afd6c66de14783efc156b69fd47d2b29f1e (diff) | |
download | kvmx-eb13690042fd1cff11e1918f421c0dbf1b0ef37a.tar.gz kvmx-eb13690042fd1cff11e1918f421c0dbf1b0ef37a.tar.bz2 |
Enhanced usage
-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 } |