vmc-ng/lib/vmc/cli.rb in vmc-0.4.0.beta.2 vs vmc-ng/lib/vmc/cli.rb in vmc-0.4.0.beta.3

- old
+ new

@@ -65,31 +65,26 @@ end if input(:services) raise NotAuthorized unless authorized - services = {} - client.system_services.each do |_, svcs| - svcs.each do |name, versions| - services[name] = versions.values - end - end + services = client.system_services if simple_output? services.each do |name, _| puts name end return end - services.each do |name, versions| + services.each do |name, meta| puts "" puts "#{c(name, :blue)}:" - puts " versions: #{versions.collect { |v| v["version"] }.join ", "}" - puts " description: #{versions[0]["description"]}" - puts " type: #{versions[0]["type"]}" + puts " versions: #{meta[:versions].join ", "}" + puts " description: #{meta[:description]}" + puts " type: #{meta[:type]}" end return end @@ -206,20 +201,27 @@ ask("Email") } flag(:password) { ask("Password", :echo => "*", :forget => true) } + flag(:verify_password) { + ask("Confirm Password", :echo => "*", :forget => true) + } flag(:no_login, :type => :boolean) def register(email = nil) unless simple_output? puts "Target: #{c(client_target, :blue)}" puts "" end email ||= input(:email) - password = input(:password) + password ||= input(:password) + if !force? && password != input(:verify_password) + fail "Passwords do not match." + end + with_progress("Creating user") do client.register(email, password) end unless input(:skip_login) @@ -282,9 +284,14 @@ desc "help [COMMAND]", "usage instructions" flag :all, :default => false group :start def help(task = nil) + if options[:version] + puts "vmc #{VERSION}" + return + end + if task self.class.task_help(@shell, task) else unless input(:all) puts "Showing basic command set. Pass --all to list all commands."