Skip to content

Commit

Permalink
Merge pull request #481 from noborus/fix-no-such-file
Browse files Browse the repository at this point in the history
Fixed to return correct error
  • Loading branch information
noborus authored Jan 9, 2024
2 parents 0bc88ba + 9409155 commit c32736e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c32736e

Please sign in to comment.