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

Function newViewCmd

pkg/cmd/codespace/view.go:25–53  ·  view source on GitHub ↗
(app *App)

Source from the content-addressed store, hash-verified

23}
24
25func newViewCmd(app *App) *cobra.Command {
26 opts := &viewOptions{}
27
28 viewCmd := &cobra.Command{
29 Use: "view",
30 Short: "View details about a codespace",
31 Example: heredoc.Doc(`
32 # Select a codespace from a list of all codespaces you own
33 $ gh cs view
34
35 # View the details of a specific codespace
36 $ gh cs view -c codespace-name-12345
37
38 # View the list of all available fields for a codespace
39 $ gh cs view --json
40
41 # View specific fields for a codespace
42 $ gh cs view --json displayName,machineDisplayName,state
43 `),
44 Args: noArgsConstraint,
45 RunE: func(cmd *cobra.Command, args []string) error {
46 return app.ViewCodespace(cmd.Context(), opts)
47 },
48 }
49 opts.selector = AddCodespaceSelector(viewCmd, app.apiClient)
50 cmdutil.AddJSONFlags(viewCmd, &opts.exporter, api.ViewCodespaceFields)
51
52 return viewCmd
53}
54
55func (a *App) ViewCodespace(ctx context.Context, opts *viewOptions) error {
56 // If we are in a codespace and a codespace name wasn't provided, show the details for the codespace we are connected to

Callers 2

NewCmdCodespaceFunction · 0.85
Test_NewCmdViewFunction · 0.85

Calls 3

AddJSONFlagsFunction · 0.92
AddCodespaceSelectorFunction · 0.85
ViewCodespaceMethod · 0.80

Tested by 1

Test_NewCmdViewFunction · 0.68