From 9409155c4b3b4f91a637a3519d47b8e4012d5991 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Tue, 9 Jan 2024 15:25:44 +0900 Subject: [PATCH] Fixed to return correct error Fixed to return correct error if filePath.Glob does not match. --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2cf564c1..7626fd75 100644 --- a/main.go +++ b/main.go @@ -125,16 +125,21 @@ func Completion(cmd *cobra.Command, arg string) error { return ErrCompletion } +// argsToFiles returns the file name from the argument. func argsToFiles(args []string) []string { var files []string for _, arg := range args { argFiles, err := filepath.Glob(arg) if err != nil { - fmt.Fprintln(os.Stderr, err) continue } files = append(files, argFiles...) } + // If filePath.Glob does not match, + // return argument to return correct error + if len(files) == 0 { + return args + } return files }