MCPcopy
hub / github.com/cli/cli / buildURL

Function buildURL

pkg/cmd/project/list/list.go:114–139  ·  view source on GitHub ↗

TODO: support non-github.com hostnames

(config listConfig)

Source from the content-addressed store, hash-verified

112
113// TODO: support non-github.com hostnames
114func buildURL(config listConfig) (string, error) {
115 var url string
116 if config.opts.owner == "@me" || config.opts.owner == "" {
117 owner, err := config.client.ViewerLoginName()
118 if err != nil {
119 return "", err
120 }
121 url = fmt.Sprintf("https://github.com/users/%s/projects", owner)
122 } else {
123 _, ownerType, err := config.client.OwnerIDAndType(config.opts.owner)
124 if err != nil {
125 return "", err
126 }
127
128 if ownerType == queries.UserOwner {
129 url = fmt.Sprintf("https://github.com/users/%s/projects", config.opts.owner)
130 } else {
131 url = fmt.Sprintf("https://github.com/orgs/%s/projects", config.opts.owner)
132 }
133 }
134
135 if config.opts.closed {
136 return url + "?query=is%3Aclosed", nil
137 }
138 return url, nil
139}
140
141func filterProjects(nodes queries.Projects, config listConfig) queries.Projects {
142 filtered := queries.Projects{

Callers 1

runListFunction · 0.85

Calls 2

ViewerLoginNameMethod · 0.80
OwnerIDAndTypeMethod · 0.80

Tested by

no test coverage detected