MCPcopy Create free account
hub / github.com/cli/cli / NewCmdDelete

Function NewCmdDelete

pkg/cmd/event/subscription/delete/delete.go:26–58  ·  view source on GitHub ↗
(f *cmdutil.Factory, runF func(*DeleteOptions) error)

Source from the content-addressed store, hash-verified

24}
25
26func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
27 opts := &DeleteOptions{
28 IO: f.IOStreams,
29 Config: f.Config,
30 EventClient: shared.EventClientFunc(f),
31 }
32
33 cmd := &cobra.Command{
34 Use: "delete <id>",
35 Short: "Delete an event subscription (preview)",
36 Long: heredoc.Doc(`
37 Delete an event subscription before it expires, which frees a place under the limit of
38 subscriptions of your account.
39
40 Event streams that are already open on the subscription are not guaranteed to close.
41 `),
42 Example: heredoc.Doc(`
43 # Delete a subscription
44 $ gh event subscription delete sub_123
45 `),
46 Args: cmdutil.ExactArgs(1, "subscription ID required"),
47 RunE: func(cmd *cobra.Command, args []string) error {
48 opts.ID = args[0]
49
50 if runF != nil {
51 return runF(opts)
52 }
53 return deleteRun(cmd.Context(), opts)
54 },
55 }
56
57 return cmd
58}
59
60func deleteRun(ctx context.Context, opts *DeleteOptions) error {
61 cfg, err := opts.Config()

Callers 1

TestNewCmdDeleteFunction · 0.70

Calls 3

EventClientFuncFunction · 0.92
ExactArgsFunction · 0.92
deleteRunFunction · 0.70

Tested by 1

TestNewCmdDeleteFunction · 0.56