opts.banner="Usage: #{progname} [options] [script to run with its parameters (optional)]"
opts.separator'Contact: Lucas Nussbaum <lucas.nussbaum@imag.fr>'
opts.separator''
opts.separator'General options:'
opts.on('-m','--machine MACHINE','Node to run on'){|n|$cfg.specifnodes<<n}
opts.on('-f','--file MACHINELIST','Files containing list of nodes'){|f|$cfg.specifnodes=readnodes(f)}
opts.on('-s','--sleep','do not exit ASAP. Katapult sleeps for a very long time at the end of the job, to allow the user to take over.'){$cfg.sleep=true}
opts.on('-n','--min-nodes NB','Minimum number of nodes needed to carry out job. We exit if we can\'t get enough nodes'){|n|$cfg.min_nodes=n.to_i}
opts.on('-l','--deploy-user USER','User owning the deployment environment'){|u|$cfg.deploy_user=u}
opts.on('-p','--deploy-part NUM','Partition number where to deploy the environment'){|p|$cfg.deploy_part=p}
opts.on('-d','--deploy-device DEV','Device where to deploy the environment'){|d|$cfg.deploy_dev=d}
opts.on('','--min-deployed-nodes NB','Minimum number of nodes that must be correctly deployed before continuing'){|n|$cfg.min_deployed_nodes=n.to_i}
opts.on('','--max-deploy-runs NB','Maximum number of kadeploy runs before we admit we cannot get enough nodes deployed'){|n|$cfg.max_deploy_runs=n.to_i}
opts.separator''
opts.separator'Options about the copy of SSH keys:'
opts.on('-c','--copy-ssh-key','Copy SSH_keys to nodes'){$cfg.copy_ssh_key=true}
opts.on('-u','--ssh-user USER','Username to use when copying keys (default: root ; can also be set using $SSH_USER)'){|u|$cfg.ssh_user=u}
opts.on('','--ssh-password PASSWORD','Password to use when copying keys (default: grid5000 ; can also be set using $SSH_PASSWORD)'){|p|$cfg.ssh_password=p}
opts.on('-i','--ssh-key-file FILE','File containing keys to copy (defaults to ~/.ssh/authorized_keys)'){|f|$cfg.ssh_keyfile=f}
opts.separator''
opts.separator'If neither --machine nor --file are specified, the nodes list is read from the $OAR_NODEFILE environment variable.'
puts"### [#{showtime}] Kadeploy run #{runs} with #{needdeploy.length} nodes (#{$nodes.length} already deployed, need #{$cfg.min_deployed_nodes-$nodes.length} more)"