28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/repo_tender/cli/status.rb', line 28
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
state = State::Store.load(paths.state_file).success
if state.repos.empty?
out.puts "(no repos in state — run `repo-tender sync` to populate)"
return CLI.record_outcome(Outcome.new(exit_code: 0))
end
out.puts ["REPO", "STATUS", "DEFAULT_BRANCH", "LAST_SYNCED_AT", "LAST_FETCH_AT"].join("\t")
state.repos.keys.sort.each do |key|
r = state.repos[key]
status_str = r.status.to_s
color = STATUS_COLORS[status_str]
styled_status = color ? pastel.decorate(status_str, color) : status_str
out.puts [
key,
styled_status,
r.default_branch.to_s,
format_time(r.last_synced_at),
format_time(r.last_fetch_at)
].join("\t")
end
CLI.record_outcome(Outcome.new(exit_code: 0))
end
|