fix: handle global help cleanly

This commit is contained in:
Vincent Koc 2026-04-22 16:37:38 -07:00
parent d4b8e38e97
commit d48e5a53cc
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
bin/
dist/
notioncrawl
/notioncrawl
*.db
*.db-*
*.log

View File

@ -26,6 +26,10 @@ func main() {
}
func run(ctx context.Context, args []string, stdout, stderr io.Writer) error {
if len(args) == 0 || args[0] == "help" || args[0] == "--help" || args[0] == "-h" {
printHelp(stdout)
return nil
}
global := flag.NewFlagSet("notioncrawl", flag.ContinueOnError)
global.SetOutput(stderr)
configPath := global.String("config", "", "config file path")