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

Function RepoGitIgnoreTemplate

api/queries_repo.go:1753–1765  ·  view source on GitHub ↗

RepoGitIgnoreTemplate fetches an available repository gitignore template. It uses API v3 here because gitignore template isn't supported by GraphQL.

(httpClient *http.Client, hostname string, gitIgnoreTemplateName string)

Source from the content-addressed store, hash-verified

1751// RepoGitIgnoreTemplate fetches an available repository gitignore template.
1752// It uses API v3 here because gitignore template isn't supported by GraphQL.
1753func RepoGitIgnoreTemplate(httpClient *http.Client, hostname string, gitIgnoreTemplateName string) (*GitIgnore, error) {
1754 var gitIgnoreTemplate GitIgnore
1755 client := NewClientFromHTTP(httpClient)
1756 path, err := safeurl.JoinPath("gitignore", "templates", gitIgnoreTemplateName)
1757 if err != nil {
1758 return nil, err
1759 }
1760 err = client.REST(hostname, "GET", path.String(), nil, &gitIgnoreTemplate)
1761 if err != nil {
1762 return nil, err
1763 }
1764 return &gitIgnoreTemplate, nil
1765}

Calls 4

JoinPathFunction · 0.92
NewClientFromHTTPFunction · 0.85
RESTMethod · 0.65
StringMethod · 0.65