Class: RepoTender::CLI::Repo::List

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

Overview

List tracked repos. One per line: “host/owner/name”.

Instance Method Summary collapse

Methods included from GlobalOptions

included

Instance Method Details

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



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/repo_tender/cli/repo.rb', line 139

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.repos.empty?
    out.puts pastel.dim("(no tracked repos)")
  else
    config.repos.each do |r|
      out.puts pastel.cyan("#{r.host}/#{r.owner}/#{r.name}")
    end
  end
  CLI.record_outcome(Outcome.new(exit_code: 0))
end