From cdc2a2cef8f0c6e44ba28af2c42973e468591fab Mon Sep 17 00:00:00 2001 From: Arthur Chaloin Date: Tue, 11 Apr 2023 17:06:13 +0200 Subject: [PATCH] refactor: explicit check for directory match on -d --- internal/exporter.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/exporter.go b/internal/exporter.go index b2e833d..aede126 100644 --- a/internal/exporter.go +++ b/internal/exporter.go @@ -298,6 +298,12 @@ func (exporter *Exporter) collectMatchingPaths(pattern string, format certificat return nil, []error{err} } + // we can get there with no errors and no output if `directories` == true + // and the pattern only evaluates to files + if directories && len(output) == 0 && len(outputErrors) == 0 { + return nil, []error{errors.New("no directory match \"" + pattern + "\"")} + } + return output, outputErrors }