From 5d69fdf8222bebc1ac96228eafc4add8a5e6af9b Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Tue, 17 Sep 2024 12:06:30 +0200 Subject: [PATCH] zoekt-index: USAGE message if no arguments supplied Test Plan: go run ./cmd/zoekt-index prints out useful instructions --- cmd/zoekt-index/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/zoekt-index/main.go b/cmd/zoekt-index/main.go index 458f18c0..4e4ee021 100644 --- a/cmd/zoekt-index/main.go +++ b/cmd/zoekt-index/main.go @@ -63,6 +63,13 @@ func main() { ignoreDirs := flag.String("ignore_dirs", ".git,.hg,.svn", "comma separated list of directories to ignore.") flag.Parse() + if flag.NArg() == 0 { + fmt.Fprintf(flag.CommandLine.Output(), "USAGE: %s [options] PATHS...\n", filepath.Base(os.Args[0])) + fmt.Fprintln(flag.CommandLine.Output(), "Options:") + flag.PrintDefaults() + os.Exit(1) + } + // Tune GOMAXPROCS to match Linux container CPU quota. _, _ = maxprocs.Set()