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

Function RepoGitIgnoreTemplates

api/queries_repo.go:1737–1749  ·  view source on GitHub ↗

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

(httpClient *http.Client, hostname string)

Source from the content-addressed store, hash-verified

1735// RepoGitIgnoreTemplates fetches available repository gitignore templates.
1736// It uses API v3 here because gitignore template isn't supported by GraphQL.
1737func RepoGitIgnoreTemplates(httpClient *http.Client, hostname string) ([]string, error) {
1738 var gitIgnoreTemplates []string
1739 client := NewClientFromHTTP(httpClient)
1740 path, err := safeurl.JoinPath("gitignore", "templates")
1741 if err != nil {
1742 return nil, err
1743 }
1744 err = client.REST(hostname, "GET", path.String(), nil, &gitIgnoreTemplates)
1745 if err != nil {
1746 return nil, err
1747 }
1748 return gitIgnoreTemplates, nil
1749}
1750
1751// RepoGitIgnoreTemplate fetches an available repository gitignore template.
1752// It uses API v3 here because gitignore template isn't supported by GraphQL.

Callers 4

listRunFunction · 0.92
NewCmdCreateFunction · 0.92
interactiveGitIgnoreFunction · 0.92

Calls 4

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