MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / NewCmdWait

Function NewCmdWait

pkg/cmd/task/wait/wait.go:69–99  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

67}
68
69func NewCmdWait(f factory.Factory) *cobra.Command {
70 var timeout int
71 var pollInterval int
72 var cancelOnTimeout bool
73 var showProgress bool
74
75 cmd := &cobra.Command{
76 Use: "wait [TaskIDs]",
77 Short: "Wait for task(s) to finish",
78 Long: "Wait for a provided list of task(s) to finish",
79 Example: heredoc.Docf("%s task wait", constants.ExecutableName),
80 RunE: func(c *cobra.Command, args []string) error {
81 taskIDs := make([]string, len(args))
82 copy(taskIDs, args)
83
84 taskIDs = append(taskIDs, util.ReadValuesFromPipe()...)
85 dependencies := cmd.NewDependencies(f, c)
86 opts := NewWaitOps(dependencies, taskIDs, timeout, pollInterval, cancelOnTimeout, showProgress, c)
87
88 return WaitRun(opts)
89 },
90 }
91
92 flags := cmd.Flags()
93 flags.IntVar(&timeout, FlagTimeout, DefaultTimeout, "Time in seconds to wait for the tasks to complete")
94 flags.IntVar(&pollInterval, FlagPollInterval, DefaultPollInterval, "Polling interval in seconds to check task status during wait")
95 flags.BoolVar(&cancelOnTimeout, FlagCancelOnTimeout, false, "Cancel the tasks if the wait timeout is reached")
96 flags.BoolVar(&showProgress, FlagProgress, false, "Show detailed progress of the tasks")
97
98 return cmd
99}
100
101func WaitRun(opts *WaitOptions) error {
102 if len(opts.TaskIDs) == 0 {

Callers

nothing calls this directly

Calls 3

ReadValuesFromPipeFunction · 0.92
NewWaitOpsFunction · 0.85
WaitRunFunction · 0.85

Tested by

no test coverage detected