|
4 | 4 | package editflags
|
5 | 5 |
|
6 | 6 | import (
|
| 7 | + "errors" |
7 | 8 | "fmt"
|
8 | 9 | "math/bits"
|
9 | 10 | "runtime"
|
@@ -45,6 +46,7 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
|
45 | 46 | })
|
46 | 47 |
|
47 | 48 | flags.StringSlice("mount", nil, commentPrefix+"Directories to mount, suffix ':w' for writable (Do not specify directories that overlap with the existing mounts)") // colima-compatible
|
| 49 | + flags.Bool("mount-none", false, commentPrefix+"Remove all mounts") |
48 | 50 |
|
49 | 51 | flags.String("mount-type", "", commentPrefix+"Mount type (reverse-sshfs, 9p, virtiofs)") // Similar to colima's --mount-type=(sshfs|9p|virtiofs), but "reverse-sshfs" is Lima is called "sshfs" in colima
|
50 | 52 | _ = cmd.RegisterFlagCompletionFunc("mount-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
|
@@ -157,6 +159,21 @@ func YQExpressions(flags *flag.FlagSet, newInstance bool) ([]string, error) {
|
157 | 159 | false,
|
158 | 160 | false,
|
159 | 161 | },
|
| 162 | + { |
| 163 | + "mount-none", |
| 164 | + func(_ *flag.Flag) (string, error) { |
| 165 | + ss, err := flags.GetStringSlice("mount") |
| 166 | + if err != nil { |
| 167 | + return "", err |
| 168 | + } |
| 169 | + if len(ss) > 0 { |
| 170 | + return "", errors.New("flag `--mount-none` conflicts with `--mount`") |
| 171 | + } |
| 172 | + return ".mounts = null", nil |
| 173 | + }, |
| 174 | + false, |
| 175 | + false, |
| 176 | + }, |
160 | 177 | {"mount-type", d(".mountType = %q"), false, false},
|
161 | 178 | {"mount-inotify", d(".mountInotify = %s"), false, true},
|
162 | 179 | {"mount-writable", d(".mounts[].writable = %s"), false, false},
|
|
0 commit comments