mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
update docs
This commit is contained in:
parent
ac819eb28f
commit
9b80d56773
3 changed files with 26 additions and 12 deletions
|
@ -63,9 +63,9 @@ and can be edited with a plain text editor.
|
||||||
|
|
||||||
### Modifying Configurations from the Command line
|
### Modifying Configurations from the Command line
|
||||||
|
|
||||||
You can override a configuration field for the current instance of `jrnl` using `--config-override CONFIG_KEY:CONFIG_VALUE` where `CONFIG_KEY` is a valid configuration field, specified in dot-notation and `CONFIG_VALUE` is the (valid) desired override value.
|
You can override a configuration field for the current instance of `jrnl` using `--config-override CONFIG_KEY CONFIG_VALUE` where `CONFIG_KEY` is a valid configuration field, specified in dot-notation and `CONFIG_VALUE` is the (valid) desired override value.
|
||||||
|
|
||||||
You can specify multiple overrides as a comma-separated list.
|
You can specify multiple overrides as multiple calls to `--config-override`.
|
||||||
!!! note
|
!!! note
|
||||||
These overrides allow you to modify ***any*** field of your jrnl configuration. We trust that you know what you are doing.
|
These overrides allow you to modify ***any*** field of your jrnl configuration. We trust that you know what you are doing.
|
||||||
|
|
||||||
|
@ -73,13 +73,14 @@ You can specify multiple overrides as a comma-separated list.
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
#Create an entry using the `stdin` prompt, for rapid logging
|
#Create an entry using the `stdin` prompt, for rapid logging
|
||||||
jrnl --config-override editor:""
|
jrnl --config-override editor ""
|
||||||
|
|
||||||
#Populate a project's log
|
#Populate a project's log
|
||||||
jrnl --config-override journal:"$(git rev-parse --show-toplevel)/todo.txt"
|
jrnl --config-override journal "$(git rev-parse --show-toplevel)/todo.txt"
|
||||||
|
|
||||||
#Pass multiple overrides
|
#Pass multiple overrides
|
||||||
jrnl --config-override display_format:fancy,linewrap:20,colors.title:green
|
jrnl --config-override display_format fancy --config-override linewrap 20 \
|
||||||
|
--config-override colors.title green
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,16 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
||||||
|
|
||||||
Scenario: Override configured editor with built-in input === editor:''
|
Scenario: Override configured editor with built-in input === editor:''
|
||||||
Given we use the config "tiny.yaml"
|
Given we use the config "tiny.yaml"
|
||||||
When we run jrnl with --config-override editor ''
|
When we run "jrnl --config-override editor ''"
|
||||||
Then the stdin prompt must be launched
|
Then the stdin prompt should have been called
|
||||||
|
|
||||||
|
Scenario: Postconfig commands with overrides
|
||||||
|
Given We use the config "basic_encrypted.yaml"
|
||||||
|
And we use the password "test" if prompted
|
||||||
|
When we run "jrnl --decrypt --config-override highlight false --config-override editor nano"
|
||||||
|
Then the runtime config should have "encrypt" set to "false"
|
||||||
|
And the runtime config should have "highlight" set to "false"
|
||||||
|
And the editor "nano" should have been called
|
||||||
|
|
||||||
@skip_win
|
@skip_win
|
||||||
Scenario: Override configured linewrap with a value of 23
|
Scenario: Override configured linewrap with a value of 23
|
||||||
|
@ -30,13 +38,13 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
||||||
@skip_win
|
@skip_win
|
||||||
Scenario: Override color selections with runtime overrides
|
Scenario: Override color selections with runtime overrides
|
||||||
Given we use the config "tiny.yaml"
|
Given we use the config "tiny.yaml"
|
||||||
When we run jrnl with -1 --config-override colors.body blue
|
When we run "jrnl -1 --config-override colors.body blue"
|
||||||
Then the runtime config should have colors.body set to blue
|
Then the runtime config should have colors.body set to blue
|
||||||
|
|
||||||
@skip_win
|
@skip_win
|
||||||
Scenario: Apply multiple config overrides
|
Scenario: Apply multiple config overrides
|
||||||
Given we use the config "tiny.yaml"
|
Given we use the config "tiny.yaml"
|
||||||
When we run jrnl with -1 --config-override colors.body green --config-override editor "nano"
|
When we run "jrnl -1 --config-override colors.body green --config-override editor 'nano'"
|
||||||
Then the runtime config should have colors.body set to green
|
Then the runtime config should have colors.body set to green
|
||||||
And the runtime config should have editor set to nano
|
And the runtime config should have editor set to nano
|
||||||
|
|
||||||
|
@ -44,7 +52,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
||||||
@skip_win
|
@skip_win
|
||||||
Scenario Outline: Override configured editor
|
Scenario Outline: Override configured editor
|
||||||
Given we use the config "tiny.yaml"
|
Given we use the config "tiny.yaml"
|
||||||
When we run jrnl with --config-override editor "<editor>"
|
When we run "jrnl --config-override editor \"<editor>\""
|
||||||
Then the editor <editor> should have been called
|
Then the editor <editor> should have been called
|
||||||
Examples: Editor Commands
|
Examples: Editor Commands
|
||||||
| editor |
|
| editor |
|
||||||
|
|
|
@ -16,6 +16,7 @@ import keyring
|
||||||
|
|
||||||
import toml
|
import toml
|
||||||
import yaml
|
import yaml
|
||||||
|
from yaml.loader import FullLoader
|
||||||
|
|
||||||
|
|
||||||
import jrnl.time
|
import jrnl.time
|
||||||
|
@ -399,9 +400,13 @@ def run(context, command, text=""):
|
||||||
if "cache_dir" in context and context.cache_dir is not None:
|
if "cache_dir" in context and context.cache_dir is not None:
|
||||||
cache_dir = os.path.join("features", "cache", context.cache_dir)
|
cache_dir = os.path.join("features", "cache", context.cache_dir)
|
||||||
command = command.format(cache_dir=cache_dir)
|
command = command.format(cache_dir=cache_dir)
|
||||||
|
if "config_path" in context and context.config_path is not None:
|
||||||
|
with open(context.config_path, "r") as f:
|
||||||
|
cfg = yaml.load(f, Loader=FullLoader)
|
||||||
|
context.jrnl_config = cfg
|
||||||
|
|
||||||
args = split_args(command)
|
args = split_args(command)
|
||||||
|
context.args = args[1:]
|
||||||
def _mock_editor(command):
|
def _mock_editor(command):
|
||||||
context.editor_command = command
|
context.editor_command = command
|
||||||
tmpfile = command[-1]
|
tmpfile = command[-1]
|
||||||
|
|
Loading…
Add table
Reference in a new issue