From 41bd69a947fb2354ac73d4db3b60963f005940d5 Mon Sep 17 00:00:00 2001 From: solnicki Date: Fri, 22 Nov 2024 10:30:23 +0100 Subject: [PATCH] add mandatory flag check --- internal/config/config.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 9cbcee0..a6258d1 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -2,6 +2,8 @@ package config import ( "flag" + "fmt" + "os" ) // Config represents user supplied program input @@ -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) + } }