talm
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5package commands6
7import (8"time"9
10"github.com/spf13/cobra"11)
12
13type trackableActionCmdFlags struct {14wait bool15debug bool16timeout time.Duration17}
18
19func (f *trackableActionCmdFlags) addTrackActionFlags(cmd *cobra.Command) {20cmd.Flags().BoolVar(&f.wait, "wait", true, "wait for the operation to complete, tracking its progress. always set to true when --debug is set")21cmd.Flags().BoolVar(&f.debug, "debug", false, "debug operation from kernel logs. --wait is set to true when this flag is set")22cmd.Flags().DurationVar(&f.timeout, "timeout", 30*time.Minute, "time to wait for the operation is complete if --debug or --wait is set")23}
24