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

Function NewCmdList

pkg/cmd/project/delete/delete.go:26–62  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

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