summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generate.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/generate.lua b/generate.lua
index 02d46a8..8deaa68 100644
--- a/generate.lua
+++ b/generate.lua
@@ -5,5 +5,9 @@ Generates activity chart
<repos...> (optional string) Paths to repositories with activity
]]
local activity = require "activity"
-local format = require("activity.formats." .. args.f)
-io.write(activity.generate_table(args.y, args.repos, format))
+local ok, maybe_format = pcall(require, "activity.formats." .. args.f)
+if not ok then
+ io.stderr:write(("couldn't find specified format: %q\n"):format(args.f))
+ os.exit(1)
+end
+io.write(activity.generate_table(args.y, args.repos, maybe_format))