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

Function NewCmdList

pkg/cmd/projectgroup/delete/delete.go:23–55  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

21}
22
23func NewCmdList(f factory.Factory) *cobra.Command {
24 confirmFlags := question.NewConfirmFlags()
25 cmd := &cobra.Command{
26 Use: "delete {<name> | <id>}",
27 Short: "Delete a project group",
28 Long: "Delete a project group in Octopus Deploy",
29 Aliases: []string{"del", "rm", "remove"},
30 Example: heredoc.Docf(`
31 %[1]s project-group delete
32 %[1]s project-group rm
33 `, constants.ExecutableName),
34 RunE: func(cmd *cobra.Command, args []string) error {
35 client, err := f.GetSpacedClient(apiclient.NewRequester(cmd))
36 if err != nil {
37 return err
38 }
39
40 opts := &DeleteOptions{
41 Client: client,
42 Ask: f.Ask,
43 NoPrompt: !f.IsPromptEnabled(),
44 IdOrName: args[0],
45 ConfirmFlags: confirmFlags,
46 }
47
48 return deleteRun(opts)
49 },
50 }
51
52 question.RegisterConfirmDeletionFlag(cmd, &confirmFlags.Confirm.Value, "project group")
53
54 return cmd
55}
56
57func deleteRun(opts *DeleteOptions) error {
58 if !opts.NoPrompt {

Callers

nothing calls this directly

Calls 6

NewConfirmFlagsFunction · 0.92
NewRequesterFunction · 0.92
deleteRunFunction · 0.70
GetSpacedClientMethod · 0.65
IsPromptEnabledMethod · 0.65

Tested by

no test coverage detected