From 796162f0d42aa104327c041f910b5922746f6aad Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 12 Sep 2023 23:20:35 +0200 Subject: Extended the CLI with more traditional option handling --- generate.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'generate.lua') diff --git a/generate.lua b/generate.lua index c9a21bf..02d46a8 100644 --- a/generate.lua +++ b/generate.lua @@ -1,5 +1,9 @@ +local args = require "pl.lapp" [[ +Generates activity chart + -f (string default 'ansi') Output format of the chart + -y (optional number) Year of the chart + (optional string) Paths to repositories with activity +]] local activity = require "activity" -local format = require "activity.formats.html5" -local args = {...} -local year = tonumber(table.remove(args, 1)) -print(activity.generate_table(year, args, format)) +local format = require("activity.formats." .. args.f) +io.write(activity.generate_table(args.y, args.repos, format)) -- cgit v1.1