Class: Gzr::Commands::Space::Top
- Inherits:
-
Gzr::Command
- Object
- Gzr::Command
- Gzr::Commands::Space::Top
- Includes:
- Space
- Defined in:
- lib/gzr/commands/space/top.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Top
constructor
A new instance of Top.
Methods included from Space
#all_spaces, #create_space, #delete_space, included, #process_args, #query_space, #query_space_children, #search_spaces
Methods inherited from Gzr::Command
#create_merge_query, #create_query, #field_expression, #field_names, #keys_to_keep, #merge_query, #pairs, #query, #render_csv, #run_inline_query
Methods included from Session
#build_connection_hash, #login, #logout_all, #pastel, #say_error, #say_ok, #say_warning, #v3_1_available?, #with_session
Constructor Details
#initialize(options) ⇒ Top
Returns a new instance of Top.
33 34 35 36 |
# File 'lib/gzr/commands/space/top.rb', line 33 def initialize() super() @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/gzr/commands/space/top.rb', line 38 def execute(input: $stdin, output: $stdout) say_warning("options: #{@options.inspect}") if @options[:debug] with_session do spaces = all_spaces("id,name,is_shared_root,is_users_root,is_root,is_user_root,is_embed_shared_root,is_embed_users_root") begin puts "No spaces found" return nil end unless spaces && spaces.length > 0 table = TTY::Table.new(header: spaces[0].to_attrs.keys) do |t| spaces.each do |h| t << h.to_attrs.values if ( h.is_shared_root || h.is_users_root || h.is_root || h.is_user_root || h. || h. ) end end if spaces[0] output.puts table.render(:ascii, alignments: [:right]) if table end end |