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

Function RepoGitIgnoreTemplates

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

1728// RepoGitIgnoreTemplates fetches available repository gitignore templates.
1729// It uses API v3 here because gitignore template isn't supported by GraphQL.
1730func RepoGitIgnoreTemplates(httpClient *http.Client, hostname string) ([]string, error) {
1731 var gitIgnoreTemplates []string
1732 client := NewClientFromHTTP(httpClient)
1733 path, err := safeurl.JoinPath("gitignore", "templates")
1734 if err != nil {
1735 return nil, err
1736 }
1737 err = client.REST(hostname, "GET", path.String(), nil, &gitIgnoreTemplates)
1738 if err != nil {
1739 return nil, err
1740 }
1741 return gitIgnoreTemplates, nil
1742}
1743
1744// RepoGitIgnoreTemplate fetches an available repository gitignore template.
1745// 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