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

Function interactiveRepoInfo

pkg/cmd/repo/create/create.go:895–916  ·  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

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