Add JSON render + small refactoring (Closes #25)

This commit is contained in:
2025-01-28 19:50:42 +01:00
parent 71fefd760e
commit 2bdcdcb1dd
5 changed files with 46 additions and 8 deletions

View File

@ -24,7 +24,7 @@ func (flags *Flags) ParseFlags() {
flag.IntVar(&flags.Controller.NumCPUs, "numcpu", runtime.NumCPU(), "Number of CPU cores to assign to this task.")
flag.IntVar(&flags.Controller.Split, "split", 1, "Split the tasks in n parts. This depends on the availability of the first row.")
flag.IntVar(&flags.Controller.Part, "part", 1, "Process part x in n parts. Cannot be lower than 1, or higher than specified in split.")
flag.StringVar(&flags.Controller.Output, "output", "human", "Type of output. 'human' for human readable. 'flat' for flat as stored in memory output.")
flag.StringVar(&flags.Controller.Output, "output", "human", "Type of output. 'human' for human readable. 'flat' for flat as stored in memory output. 'json' for JSON output.")
// Parse the flags
flag.Parse()
@ -75,7 +75,7 @@ func (flags *Flags) ParseFlags() {
// Process output selection
flags.Controller.Output = strings.ToLower(flags.Controller.Output)
if flags.Controller.Output != "human" && flags.Controller.Output != "flat" {
if flags.Controller.Output != "human" && flags.Controller.Output != "flat" && flags.Controller.Output != "json" {
log.Printf("ERROR: Invalid output, can only be 'human' or 'flat'.\n")
flags.printUsage()
os.Exit(1)