Class: VMC::Start::Info
- Defined in:
- lib/vmc/cli/start/info.rb
Instance Method Summary collapse
Methods inherited from Base
#displayed_target?, #precondition
Methods inherited from CLI
#check_logged_in, #check_target, #client, client, client=, #client_target, #color_enabled?, #default_action, #ensure_config_dir, #err, #execute, #fail, #force?, #invalidate_client, #log_error, #name_list, #no_v2, #one_of, #precondition, #quiet?, #remove_target_info, #sane_target_url, #save_target_info, #save_targets, #set_target, #table, #target_file, #target_info, #targets_info, #tokens_file, #user_colors, #v2?, #verbose?
Methods included from VMC::Spacing
#indented, #justify, #line, #lines, #quiet?, #spaced, #start_line, #tabular, #text_width, #trim_escapes
Methods included from Interactive
#ask, #handler, #input_state, #list_choices, #prompt, #show_default
Instance Method Details
#info ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/vmc/cli/start/info.rb', line 17 def info all = input[:all] if all || input[:runtimes] runtimes = with_progress("Getting runtimes") do client.runtimes end end if all || input[:frameworks] frameworks = with_progress("Getting frameworks") do client.frameworks end end if all || input[:services] services = with_progress("Getting services") do client.services end end info = client.info showing_any = runtimes || services || frameworks unless !all && showing_any line if showing_any line info[:description] line line "target: #{b(client.target)}" indented do line "version: #{info[:version]}" line "support: #{info[:support]}" end if user = client.current_user line line "user: #{b(user.email || user.guid)}" end end if runtimes line unless quiet? if runtimes.empty? && !quiet? line "#{d("none")}" elsif input[:quiet] runtimes.each do |r| line r.name end else table( %w{runtime description}, runtimes.sort_by(&:name).collect { |r| [c(r.name, :name), r.description] }) end end if frameworks line unless quiet? if frameworks.empty? && !quiet? line "#{d("none")}" elsif input[:quiet] frameworks.each do |f| line f.name end else table( %w{framework description}, frameworks.sort_by(&:name).collect { |f| [c(f.name, :name), f.description] }) end end if services line unless quiet? if services.empty? && !quiet? line "#{d("none")}" elsif input[:quiet] services.each do |s| line s.label end else table( ["service", "version", "provider", v2? && "plans", "description"], services.sort_by(&:label).collect { |s| next if !v2? && s.deprecated? [c(s.label, :name), s.version, s.provider, v2? && s.service_plans.collect(&:name).join(", "), s.description ] }) end end end |