Updated argument count validation
This commit is contained in:
@@ -64,7 +64,7 @@ func main() {
|
|||||||
// 2. Build NFA from postfix representation (Thompson's algorithm)
|
// 2. Build NFA from postfix representation (Thompson's algorithm)
|
||||||
// 3. Run the string against the NFA
|
// 3. Run the string against the NFA
|
||||||
|
|
||||||
if len(flag.Args()) != 1 { // flag.Args() also strips out program name
|
if len(flag.Args()) < 1 || len(flag.Args()) > 2 { // flag.Args() also strips out program name
|
||||||
fmt.Println("ERROR: Missing cmdline args")
|
fmt.Println("ERROR: Missing cmdline args")
|
||||||
os.Exit(22)
|
os.Exit(22)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user