From 67f81d2728b9adc724a6869a2994d7db4385a58a Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Fri, 7 Jul 2023 11:10:31 +0100 Subject: [PATCH] Silence usage message on runtime error --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index c259bf0..4390727 100644 --- a/main.go +++ b/main.go @@ -77,6 +77,10 @@ func init() { } func run(c *cobra.Command, args []string) error { + // if we got past argument passing, then returned errors are runtime + // things (like file not found) that shouldn't trigger a usage message. + c.SilenceUsage = true + display = NewDisplay(noColour) if len(searchRegexp) == 0 && len(searchFixed) == 0 {