Skip to content

Commit dd6492c

Browse files
committed
fix condition
1 parent 8ed779b commit dd6492c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Diff for: internal/shell/bash/action.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strings"
77

88
"github.com/carapace-sh/carapace/internal/common"
9+
"github.com/carapace-sh/carapace/internal/log"
910
)
1011

1112
var sanitizer = strings.NewReplacer(
@@ -105,13 +106,11 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
105106
nospace = nospace || meta.Nospace.Matches(val.Value)
106107

107108
vals[index] = sanitizer.Replace(val.Value)
108-
if requiresQuoting(vals[index]) {
109-
switch {
110-
case strings.HasPrefix(vals[index], "~"): // assume homedir expansion
111-
vals[index] = "~" + escapingReplacer.Replace(strings.TrimPrefix(vals[index], "~"))
112-
default:
113-
vals[index] = fmt.Sprintf(`"%v"`, escapingQuotedReplacer.Replace(vals[index]))
114-
}
109+
switch {
110+
case strings.HasPrefix(vals[index], "~"): // assume homedir expansion
111+
vals[index] = "~" + escapingReplacer.Replace(strings.TrimPrefix(vals[index], "~"))
112+
case requiresQuoting(vals[index]):
113+
vals[index] = fmt.Sprintf(`"%v"`, escapingQuotedReplacer.Replace(vals[index]))
115114
}
116115
} else {
117116
nospace = true

0 commit comments

Comments
 (0)