TODO: support non-github.com hostnames
(config listConfig)
| 112 | |
| 113 | // TODO: support non-github.com hostnames |
| 114 | func 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 | |
| 141 | func filterProjects(nodes queries.Projects, config listConfig) queries.Projects { |
| 142 | filtered := queries.Projects{ |
no test coverage detected