mirror of
https://github.com/TecharoHQ/anubis.git
synced 2026-04-15 12:58:45 +00:00
fix: improve usage message and error handling for input file requirement
This commit is contained in:
@@ -45,15 +45,22 @@ type AnubisRule struct { // betteralign:ignore, we want name to be the first fie
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Usage = func() {
|
||||||
|
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
|
||||||
|
flag.PrintDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *helpFlag || flag.NFlag() == 0 {
|
if *helpFlag || flag.NFlag() == 0 {
|
||||||
showHelp()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if *inputFile == "" {
|
if *inputFile == "" {
|
||||||
log.Fatal("input file is required (use -input flag or -help for usage)")
|
fmt.Fprintln(os.Stderr, "Error: input file is required.")
|
||||||
|
flag.Usage()
|
||||||
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read robots.txt
|
// Read robots.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user