Class: Space::Core::CLI::Status

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_core/cli/status.rb

Instance Method Summary collapse

Methods included from Helpers

#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal

Instance Method Details

#call(rest: [], **opts) ⇒ Object

One command, overloaded by its positional(s):

help token (`help`, or dry-cli's -h/--help which never reach here) → help
lone keyword / `<space> <keyword>`                                 → set
bare, or a lone non-keyword identifier                            → report


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/space_core/cli/status.rb', line 12

def call(rest: [], **opts)
  setup_terminal(**opts.slice(:color, :colors))
  args = Array(rest)
  return show_help if help_token?(args)

  handle_errors do
    if set_args?(args)
      set_status(args)
    elsif args.length <= 1
      report(args.first)
    else
      raise Space::Core::Error, "Usage: space status [SPACE] STATUS"
    end
  end
end