Class: RepoTender::CLI::ConfigCmd::Show

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
GlobalOptions
Defined in:
lib/repo_tender/cli/config.rb

Instance Method Summary collapse

Methods included from GlobalOptions

included

Instance Method Details

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



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/repo_tender/cli/config.rb', line 37

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
  # Emit via the store's own emit() so the format matches
  # what `config.yaml` looks like on disk (stable key order
  # per Slice 1's emit implementation). This makes
  # `config show` a faithful round-trip preview.
  out.puts pastel.cyan(Config::Store.emit(config.to_h).chomp)
  CLI.record_outcome(Outcome.new(exit_code: 0))
end