On Thu, Nov 05, 2020 at 09:38:44AM +0800, Xiao Shenwei wrote:
Usage: multi-qemu [-n] [-c] [-q]
The above is not accurate: -n/-c/-q all takes value.
-n, --name HOSTNAME_PREFIX specify used hostname_prefix -c, --count count how much VM do you need -q, --queues queues requested queues, use "," to separate more than 2 values -h, --help show this message
example: ./multi-qemu -n vm-2p8g.xsw -c 2 -q vm-2p8g~xsw,vm-2p8g.aarch64
Looks fake example. multi-qemu is not for personal use?
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
providers/multi-qemu | 99 +++++++++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 25 deletions(-)
diff --git a/providers/multi-qemu b/providers/multi-qemu index 23e0451..bddad08 100755 --- a/providers/multi-qemu +++ b/providers/multi-qemu @@ -4,46 +4,95 @@ # frozen_string_literal: true
require 'fileutils' +require 'optparse' +require 'time'
-PWD = Dir.pwd +opt = {} +options = OptionParser.new do |opts|
- opts.banner = 'Usage: multi-qemu [-n] [-c] [-q]'
- opts.separator ''
- opts.on('-n HOSTNAME_PREFIX', '--name HOSTNAME_PREFIX', 'specify used hostname_prefix') do |name|
"specify used hostname_prefix" means nothing other than repeating HOSTNAME_PREFIX.
- opt['hostname_prefix'] = name
- end
- opts.on('-c count', '--count count', 'how much VM do you need') do |num|
how much => how many
- opt['nr_vm'] = num
- end
- opts.on('-q queues', '--queues queues', 'requested queues, use "," to separate more than 2 values') do |queues|
=> separated by ","
- opt['queues'] = queues
- end
- opts.on_tail('-h', '--help', 'show this message') do
- puts opts
- exit
- end
+end
+if ARGV.size.zero?
- puts options
- exit
exit 1