Skip to content

Commit e74268d

Browse files
authored
Merge pull request #1864 from AkihiroSuda/implement-1861
limactl: make `--tty` to be a global flag
2 parents a48d71f + 92cdf5e commit e74268d

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

cmd/limactl/edit.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/lima-vm/lima/pkg/store"
1717
"github.com/lima-vm/lima/pkg/store/filenames"
1818
"github.com/lima-vm/lima/pkg/yqutil"
19-
"github.com/mattn/go-isatty"
2019
"github.com/sirupsen/logrus"
2120
"github.com/spf13/cobra"
2221
)
@@ -29,8 +28,6 @@ func newEditCommand() *cobra.Command {
2928
RunE: editAction,
3029
ValidArgsFunction: editBashComplete,
3130
}
32-
// TODO: "survey" does not support using cygwin terminal on windows yet
33-
editCommand.Flags().Bool("tty", isatty.IsTerminal(os.Stdout.Fd()), "enable TUI interactions such as opening an editor, defaults to true when stdout is a terminal")
3431
editflags.RegisterEdit(editCommand)
3532
return editCommand
3633
}

cmd/limactl/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func newApp() *cobra.Command {
5858
}
5959
rootCmd.PersistentFlags().String("log-level", "", "Set the logging level [trace, debug, info, warn, error]")
6060
rootCmd.PersistentFlags().Bool("debug", false, "debug mode")
61+
// TODO: "survey" does not support using cygwin terminal on windows yet
62+
rootCmd.PersistentFlags().Bool("tty", isatty.IsTerminal(os.Stdout.Fd()), "Enable TUI interactions such as opening an editor. Defaults to true when stdout is a terminal. Set to false for automation.")
6163
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
6264
l, _ := cmd.Flags().GetString("log-level")
6365
if l != "" {

cmd/limactl/start.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@ import (
2424
"github.com/lima-vm/lima/pkg/store/filenames"
2525
"github.com/lima-vm/lima/pkg/templatestore"
2626
"github.com/lima-vm/lima/pkg/yqutil"
27-
"github.com/mattn/go-isatty"
2827
"github.com/sirupsen/logrus"
2928
"github.com/spf13/cobra"
3029
)
3130

3231
func registerCreateFlags(cmd *cobra.Command, commentPrefix string) {
3332
flags := cmd.Flags()
34-
// TODO: "survey" does not support using cygwin terminal on windows yet
35-
flags.Bool("tty", isatty.IsTerminal(os.Stdout.Fd()), commentPrefix+"enable TUI interactions such as opening an editor, defaults to true when stdout is a terminal")
3633
flags.String("name", "", commentPrefix+"override the instance name")
3734
flags.Bool("list-templates", false, commentPrefix+"list available templates and exit")
3835
editflags.RegisterCreate(cmd, commentPrefix)

hack/test-port-forwarding.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# running to perform the tests:
77
#
88
# ./hack/test-port-forwarding.pl templates/default.yaml
9-
# limactl start --tty=false templates/default.yaml
9+
# limactl --tty=false start templates/default.yaml
1010
# git restore templates/default.yaml
1111
# ./hack/test-port-forwarding.pl default
1212
#

hack/test-templates.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ INFO "Validating \"$FILE\""
1717
limactl validate "$FILE"
1818

1919
# --cpus=1 is needed for running vz on GHA: https://github.com/lima-vm/lima/pull/1511#issuecomment-1574937888
20-
LIMACTL_CREATE=(limactl create --tty=false --cpus=1 --memory=1)
20+
LIMACTL_CREATE=(limactl --tty=false create --cpus=1 --memory=1)
2121

2222
CONTAINER_ENGINE="nerdctl"
2323

0 commit comments

Comments
 (0)