DocsCareFetching config files

Fetching config files

Pull canonical linter, release, and license files into a repo with care get.

care get fetches a config file into the current repo from any source and, optionally, rewrites placeholder tokens on the way in. It decouples which file goes where from where the bytes come from, so you keep best-practice configs consistent across repos without copy-pasting.

Fetching a file

The source is the first positional argument. The destination defaults to the source's filename, or set it with --out.

care get toaweme/care/templates/.golangci.yml                    # write ./.golangci.yml
care get toaweme/care/templates/.golangci.yml --out config/x.yml # choose the destination
care get ./local/x.yml --force                                   # overwrite an existing file

An existing destination is left untouched unless you pass --force.

Where sources resolve from

Sources resolve in this order.

  • A local file, any ./, ~, file://, or existing path.
  • A remote, a real github.com, raw.githubusercontent.com, or gist URL, or the owner/repo/path shorthand.

Local sources are zero-network. A remote fetch is explicit. Set a GitHub token for private sources with --token, or through the GITHUB_TOKEN environment variable.

Rewriting placeholder tokens

Pass -r token=value to replace every occurrence of a token in the fetched bytes. Repeat -r for each replacement.

care get owner/repo/path/LICENSE -r __YEAR__=2027 -r '__HOLDER__=toawe.me Authors'

Each pair splits on the first =, so the value may contain any character (spaces, commas, quotes, even =) as long as your shell passes it as one argument. The token itself may not contain =.

Note

If a token starts with -, use the glued form -r=token=value so the shell does not read it as a new flag.

Every care get flag is in the commands reference.