summaryrefslogtreecommitdiff
path: root/generate.lua
blob: 478bc9ddf0868b94b11f3ef63d11f8d7be14a1b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/lua
local args = require "pl.lapp" [[
Generates activity chart
	-f  (string default 'ansi')    Output format of the chart
	-y  (optional number)          Year of the chart
	-R                             Generate rolling chart
	<repos...>  (optional string)  Paths to repositories with activity
]]
local generators = require "activity.generators"
local git = require "activity.git"
local ok, maybe_format = pcall(require, "activity.formats." .. args.f)
if not ok then
	io.stderr:write(("could not find specified format: %q\n\n"):format(args.f))
	io.stderr:write(maybe_format, "\n")
	os.exit(1)
end
local maybe_year = args.y
if args.R then
	maybe_year = "rolling"
end
io.write(generators.generate_table(maybe_year, git.lookup(args.repos), maybe_format))