Skip to content

Commit

Permalink
powershell: fix nospace for quoted values
Browse files Browse the repository at this point in the history
- needs to be checked before altering the value
  • Loading branch information
rsteube committed Jun 20, 2023
1 parent bd8337c commit a61a612
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/shell/powershell/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
for _, val := range values {
if val.Value != "" { // must not be empty - any empty `''` parameter in CompletionResult causes an error
val.Value = sanitizer.Replace(val.Value)
nospace := meta.Nospace.Matches(val.Value)

if strings.ContainsAny(val.Value, ` {}()[]*$?\"|<>&(),;#`+"`") {
val.Value = fmt.Sprintf("'%v'", val.Value)
}

if !meta.Nospace.Matches(val.Value) {
if !nospace {
val.Value = val.Value + " "
}

Expand Down

0 comments on commit a61a612

Please sign in to comment.