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

Function RepoGitIgnoreTemplate

api/queries_repo.go:1746–1758  ·  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

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

Calls 4

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