Skip to content

Commit b2e94ac

Browse files
committed
editflags: update the expression for mount flag
Signed-off-by: ashwat287 <[email protected]>
1 parent 86a7a5a commit b2e94ac

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cmd/limactl/editflags/editflags.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ func YQExpressions(flags *flag.FlagSet, newInstance bool) ([]string, error) {
232232
if err != nil {
233233
return "", err
234234
}
235-
expr := `.mounts += ` + mountListExpr + ` | .mounts |= unique_by(.location)`
235+
// mount options take precedence over template settings
236+
expr := fmt.Sprintf(".mounts = %s + .mounts", mountListExpr)
236237
mountOnly, err := flags.GetStringSlice("mount-only")
237238
if err != nil {
238239
return "", err

cmd/limactl/editflags/editflags_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func TestYQExpressions(t *testing.T) {
181181
name: "mount",
182182
args: []string{"--mount", "/foo", "--mount", "./bar:w"},
183183
newInstance: false,
184-
expected: []string{`.mounts += [{"location": "` + expand("/foo") + `", "writable": false},{"location": "` + expand("./bar") + `", "writable": true}] | .mounts |= unique_by(.location)`},
184+
expected: []string{`.mounts = [{"location": "` + expand("/foo") + `", "writable": false},{"location": "` + expand("./bar") + `", "writable": true}] + .mounts`},
185185
},
186186
{
187187
name: "mount-only",

0 commit comments

Comments
 (0)