MCPcopy Index your code
hub / github.com/cli/cli / NewCmdDelete

Function NewCmdDelete

pkg/cmd/release/delete/delete.go:35–65  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*DeleteOptions) error)

Source from the content-addressed store, hash-verified

33}
34
35func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
36 opts := &DeleteOptions{
37 IO: f.IOStreams,
38 HttpClient: f.HttpClient,
39 GitClient: f.GitClient,
40 Prompter: f.Prompter,
41 }
42
43 cmd := &cobra.Command{
44 Use: "delete <tag>",
45 Short: "Delete a release",
46 Args: cobra.ExactArgs(1),
47 RunE: func(cmd *cobra.Command, args []string) error {
48 // support `-R, --repo` override
49 opts.BaseRepo = f.BaseRepo
50 opts.RepoOverride, _ = cmd.Flags().GetString("repo")
51
52 opts.TagName = args[0]
53
54 if runF != nil {
55 return runF(opts)
56 }
57 return deleteRun(opts)
58 },
59 }
60
61 cmd.Flags().BoolVarP(&opts.SkipConfirm, "yes", "y", false, "Skip the confirmation prompt")
62 cmd.Flags().BoolVar(&opts.CleanupTag, "cleanup-tag", false, "Delete the specified tag in addition to its release")
63
64 return cmd
65}
66
67func deleteRun(opts *DeleteOptions) error {
68 httpClient, err := opts.HttpClient()

Callers 1

Test_NewCmdDeleteFunction · 0.70

Calls 1

deleteRunFunction · 0.70

Tested by 1

Test_NewCmdDeleteFunction · 0.56