diff --git a/cmd/limactl/main.go b/cmd/limactl/main.go index 874a4a10165..5b255394414 100644 --- a/cmd/limactl/main.go +++ b/cmd/limactl/main.go @@ -125,6 +125,7 @@ func newApp() *cobra.Command { // TODO: "survey" does not support using cygwin terminal on windows yet 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.") rootCmd.PersistentFlags().BoolP("yes", "y", false, "Alias of --tty=false") + rootCmd.MarkFlagsMutuallyExclusive("tty", "yes") rootCmd.PersistentPreRunE = func(cmd *cobra.Command, _ []string) error { if err := processGlobalFlags(rootCmd); err != nil { return err @@ -150,10 +151,6 @@ func newApp() *cobra.Command { return errors.New("must not run on NFS dir") } - if cmd.Flags().Changed("yes") && cmd.Flags().Changed("tty") { - return errors.New("cannot use both --tty and --yes flags at the same time") - } - if cmd.Flags().Changed("yes") { // Sets the value of the yesValue flag by using the yes flag. yesValue, _ := cmd.Flags().GetBool("yes")