MCPcopy
hub / github.com/cli/cli / interactiveRepoInfo

Function interactiveRepoInfo

pkg/cmd/repo/create/create.go:896–917  ·  view source on GitHub ↗

name, description, and visibility

(client *http.Client, hostname string, prompter iprompter, defaultName string)

Source from the content-addressed store, hash-verified

894
895// name, description, and visibility
896func interactiveRepoInfo(client *http.Client, hostname string, prompter iprompter, defaultName string) (string, string, string, error) {
897 name, owner, err := interactiveRepoNameAndOwner(client, hostname, prompter, defaultName)
898 if err != nil {
899 return "", "", "", err
900 }
901 if owner != "" {
902 name = fmt.Sprintf("%s/%s", owner, name)
903 }
904
905 description, err := prompter.Input("Description", "")
906 if err != nil {
907 return "", "", "", err
908 }
909
910 visibilityOptions := getRepoVisibilityOptions(owner)
911 selected, err := prompter.Select("Visibility", "Public", visibilityOptions)
912 if err != nil {
913 return "", "", "", err
914 }
915
916 return name, description, strings.ToUpper(visibilityOptions[selected]), nil
917}
918
919func getRepoVisibilityOptions(owner string) []string {
920 visibilityOptions := []string{"Public", "Private"}

Callers 3

createFromScratchFunction · 0.85
createFromTemplateFunction · 0.85
createFromLocalFunction · 0.85

Calls 4

getRepoVisibilityOptionsFunction · 0.85
InputMethod · 0.65
SelectMethod · 0.65

Tested by

no test coverage detected