MCPcopy
hub / github.com/cli/cli / AddCodespaceSelector

Function AddCodespaceSelector

pkg/cmd/codespace/codespace_selector.go:24–35  ·  view source on GitHub ↗

AddCodespaceSelector adds persistent flags for selecting a codespace to the given command and returns a CodespaceSelector which applies them

(cmd *cobra.Command, api apiClient)

Source from the content-addressed store, hash-verified

22
23// AddCodespaceSelector adds persistent flags for selecting a codespace to the given command and returns a CodespaceSelector which applies them
24func AddCodespaceSelector(cmd *cobra.Command, api apiClient) *CodespaceSelector {
25 cs := &CodespaceSelector{api: api}
26
27 cmd.PersistentFlags().StringVarP(&cs.codespaceName, "codespace", "c", "", "Name of the codespace")
28 cmd.PersistentFlags().StringVarP(&cs.repoName, "repo", "R", "", "Filter codespace selection by repository name (user/repo)")
29 cmd.PersistentFlags().StringVar(&cs.repoOwner, "repo-owner", "", "Filter codespace selection by repository owner (username or org)")
30
31 cmd.MarkFlagsMutuallyExclusive("codespace", "repo")
32 cmd.MarkFlagsMutuallyExclusive("codespace", "repo-owner")
33
34 return cs
35}
36
37func (cs *CodespaceSelector) Select(ctx context.Context) (codespace *api.Codespace, err error) {
38 if cs.codespaceName != "" {

Callers 12

newLogsCmdFunction · 0.85
newStopCmdFunction · 0.85
newCodeCmdFunction · 0.85
newRebuildCmdFunction · 0.85
newDeleteCmdFunction · 0.85
newSSHCmdFunction · 0.85
newCpCmdFunction · 0.85
newEditCmdFunction · 0.85
newJupyterCmdFunction · 0.85
newPortsCmdFunction · 0.85
newViewCmdFunction · 0.85
newSelectCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected