Class: Space::Src::CLI::Org::List

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
GlobalOptions, Helpers
Defined in:
lib/space_src/cli/org.rb

Instance Method Summary collapse

Methods included from GlobalOptions

included

Methods included from Helpers

fail_with, format_failure, format_ignored, format_ref, parse_ref, same_org?

Instance Method Details

#call(plain: nil, json: nil, no_color: nil, quiet: nil) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/space_src/cli/org.rb', line 170

def call(plain: nil, json: nil, no_color: nil, quiet: nil, **)
  mode = UI::Mode.resolve(
    flags: {plain: plain, json: json, no_color: no_color, quiet: quiet},
    env: CLI.env,
    out: out
  )
  pastel = Pastel.new(enabled: mode.color)

  paths = CLI.make_paths
  config = Config::Store.load(paths.config_file).success
  if config.orgs.empty?
    out.puts pastel.dim("(no tracked orgs)")
  else
    config.orgs.each do |o|
      out.puts pastel.cyan("#{o.host}/#{o.name}" \
        " (include_archived=#{o.include_archived}, include_forks=#{o.include_forks})" \
        "#{format_ignored(o)}")
    end
  end
  CLI.record_outcome(Outcome.new(exit_code: 0))
end