Skip to content

Commit 8f37827

Browse files
committed
fix passing multiple args: include commas
1 parent fad704e commit 8f37827

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
set -euo pipefail
2929

30-
version=0.0.15 # TODO integrate with releases.
30+
version=0.0.16 # TODO integrate with releases.
3131

3232
settle_base=$(pwd)
3333

internal/brew/brew.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,18 @@ type Pkg struct {
200200
}
201201

202202
func (p Pkg) String() string {
203-
components := []string{fmt.Sprintf(`brew "%s"`, p.Name)}
203+
var sb strings.Builder
204+
sb.WriteString(fmt.Sprintf("brew %q", p.Name))
204205
if len(p.Args) > 0 {
205-
components = append(components, ", args: [")
206+
sb.WriteString(", args: [")
207+
var arrayEntries []string
206208
for _, arg := range p.Args {
207-
components = append(components, fmt.Sprintf(`"%s"`, arg))
209+
arrayEntries = append(arrayEntries, fmt.Sprintf("%q", arg))
208210
}
209-
components = append(components, "]")
211+
sb.WriteString(strings.Join(arrayEntries, ","))
212+
sb.WriteString("]")
210213
}
211-
return strings.Join(components, "")
214+
return sb.String()
212215
}
213216

214217
type Casks []Cask

0 commit comments

Comments
 (0)