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

Function RepoGitIgnoreTemplates

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

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