From c3c2e882c9c4ce0717072d959fdcb3c7081a9c7f Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Mon, 13 Jan 2025 21:13:39 -0800 Subject: [PATCH] docs config: an advanced example of `--config` syntax This seems non-trivial to discover and could be useful for people transitioning from `--config-toml`. --- docs/config.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/config.md b/docs/config.md index 4a4ec85bdd..4a9a605427 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1319,11 +1319,20 @@ to specify additional configuration settings. This overrides settings defined in config files or environment variables. For example, ```shell -jj --config=ui.color=always --config=ui.diff-editor=kdiff3 split +# Must not have spaces around the `=` +jj --config ui.color=always --config ui.diff-editor=kdiff3 split ``` Config value should be specified as a TOML expression. If string value doesn't contain any TOML constructs (such as array notation), quotes can be omitted. +Here is an example with more advanced TOML constructs: + +```shell +# Single quotes and the '\' are interpreted by the shell and assume a Unix shell +# Double quotes are passed to jj and are parsed as TOML syntax +jj log --config \ + 'template-aliases."format_timestamp(timestamp)"="""timestamp.format("%Y-%m-%d %H:%M %:::z")"""' +``` To load an entire TOML document, use `--config-file`: