From 95fae072c3b42c8268db35a3033391088c097414 Mon Sep 17 00:00:00 2001 From: noborus Date: Tue, 9 Jan 2024 13:40:18 +0900 Subject: [PATCH] Enabled wildcard specification even on Windows Windows does not expand wildcards using the shell, so use filepath.Glob. --- main.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 1c1a8215..2cf564c1 100644 --- a/main.go +++ b/main.go @@ -125,9 +125,23 @@ func Completion(cmd *cobra.Command, arg string) error { return ErrCompletion } +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...) + } + return files +} + // RunOviewer displays the argument file. func RunOviewer(args []string) error { - ov, err := oviewer.Open(args...) + files := argsToFiles(args) + ov, err := oviewer.Open(files...) if err != nil { return err }