5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/spill/cli.rb', line 5
def self.run(argv, stdout: $stdout)
options = { github: true }
early_exit = false
parser = OptionParser.new do |opts|
opts.banner = "Usage: spill [ROOT] [options]"
opts.on("--since EXPR", 'Window start: "yesterday", "3 days ago", "2026-07-01"') { |v| options[:since] = v }
opts.on("--author EMAIL", "Override the commit author for all repos") { |v| options[:author] = v }
opts.on("--no-github", "Skip the GitHub layer") { options[:github] = false }
opts.on("--version", "Print version") do
stdout.puts Spill::VERSION
early_exit = true
end
opts.on("-h", "--help", "Show this help") do
stdout.puts opts
early_exit = true
end
end
args = parser.parse(argv)
return 0 if early_exit
spinner_enabled = $stderr.tty? && stdout.respond_to?(:tty?) && stdout.tty?
report = Spinner.around(enabled: spinner_enabled) { build_report(args, options) }
color = stdout.respond_to?(:tty?) && stdout.tty? && ENV["NO_COLOR"].nil?
stdout.puts Renderer.render(report, color: color)
0
rescue OptionParser::ParseError, ArgumentError => e
stdout.puts "spill: #{e.message}"
0
end
|