Skip to content

Read and write CLI settings

$ grim config list

grim keeps a handful of per-user settings in one JSON file in your home directory: the GitHub token and user name, whether error reports are sent, an identifier for this installation. Most of them are written by other commands. You reach for grim config to look at what is there, to switch error reporting off, or to remove a value without opening the file.

It has nothing to do with a project. What a project is made of lives in grim.json.

Usage

$ grim config list                     # everything, secrets shortened
$ grim config get github_user          # one value, printed bare
$ grim config set telemetry 0          # write one value
$ grim config remove github_token      # delete one key

It runs from anywhere. The file is ~/.grim/config.json and is created on the first set.

Arguments and options

Manage grim-cli configuration (~/.grim/config.json)

Usage

grim config <action> [<key> [<value>]]

Arguments

Argument Description
action Action: get, set, remove, list (required)
key Config key (optional)
value Config value (for set) (optional)

What it actually does

  1. list prints every key with its value. github_token and anthropic_api_key are cut to their first ten characters. With an empty file it prints No configuration set.
  2. get prints one value and nothing else, so it can be used in a script. A key that is not there gives <key> is not set, still with exit code 0.
  3. set writes the value as a string and echoes it back, shortened for the two secret keys. Any key name is accepted; grim does not check it against a list.
  4. remove deletes the key and says so, whether or not it existed.

An action other than these four ends with Unknown action: <action>. Use: get, set, remove, list.

Keys grim reads

Key Written by Meaning
github_token grim auth:login The token for GitHub and GHCR.
github_user grim auth:login The login that token belongs to.
authenticated_at grim auth:login When the token was stored.
telemetry You Error reports are sent unless this is off.
install_id grim A random identifier sent with error reports.

Pitfalls

set telemetry false leaves reporting on

Every value is stored as a string, and the string "false" counts as on. Use grim config set telemetry 0, or export GRIM_TELEMETRY=0, which wins over the file either way.

get prints a secret in full

Only list and the echo of set shorten the token. grim config get github_token prints all of it, into your terminal and its scrollback.

Setting the token here skips everything login does

grim config set github_token … stores the string and nothing more. It is not validated, and Composer and Docker never hear of it. Use grim auth:login --token instead.

After it finishes

The change applies to the next grim command. Nothing needs restarting.

Recipes that use it