Skip to content

Commit

Permalink
add mandatory flag check
Browse files Browse the repository at this point in the history
  • Loading branch information
solnicki committed Nov 22, 2024
1 parent 5f94952 commit 41bd69a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package config

import (
"flag"
"fmt"
"os"
)

// Config represents user supplied program input
Expand Down Expand Up @@ -30,4 +32,11 @@ func (c *Config) LoadAndValidate() {
flag.BoolVar(&c.IsProofWriter, "p", true, "Disable proof wrtier (default: Enabled)")

flag.Parse()

// Check if mandatory flags are set
if c.InputPath == "" {
fmt.Println("Error: -i flag is mandatory")
flag.Usage()
os.Exit(1)
}
}

0 comments on commit 41bd69a

Please sign in to comment.