MCPcopy
hub / github.com/cli/cli / newStopCmd

Function newStopCmd

pkg/cmd/codespace/stop.go:19–38  ·  view source on GitHub ↗
(app *App)

Source from the content-addressed store, hash-verified

17}
18
19func newStopCmd(app *App) *cobra.Command {
20 opts := &stopOptions{}
21
22 stopCmd := &cobra.Command{
23 Use: "stop",
24 Short: "Stop a running codespace",
25 Args: noArgsConstraint,
26 RunE: func(cmd *cobra.Command, args []string) error {
27 if opts.orgName != "" && opts.selector.codespaceName != "" && opts.userName == "" {
28 return cmdutil.FlagErrorf("using `--org` with `--codespace` requires `--user`")
29 }
30 return app.StopCodespace(cmd.Context(), opts)
31 },
32 }
33 opts.selector = AddCodespaceSelector(stopCmd, app.apiClient)
34 stopCmd.Flags().StringVarP(&opts.orgName, "org", "o", "", "The `login` handle of the organization (admin-only)")
35 stopCmd.Flags().StringVarP(&opts.userName, "user", "u", "", "The `username` to stop codespace for (used with --org)")
36
37 return stopCmd
38}
39
40func (a *App) StopCodespace(ctx context.Context, opts *stopOptions) error {
41 var (

Callers 1

NewCmdCodespaceFunction · 0.85

Calls 3

FlagErrorfFunction · 0.92
AddCodespaceSelectorFunction · 0.85
StopCodespaceMethod · 0.65

Tested by

no test coverage detected