mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-05 07:56:14 +02:00
rename --override to --config-override
This commit is contained in:
parent
f978cee899
commit
1a8bcfca64
5 changed files with 8 additions and 8 deletions
|
@ -2,17 +2,17 @@ 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 "editor-args.yaml"
|
Given we use the config "editor-args.yaml"
|
||||||
When we run "jrnl --override '{\"editor\": \"\""}'"
|
When we run "jrnl --config-override '{\"editor\": \"\""}'"
|
||||||
Then the editor "" should have been called
|
Then the editor "" should have been called
|
||||||
|
|
||||||
Scenario: Override configured editor with 'nano'
|
Scenario: Override configured editor with 'nano'
|
||||||
Given we use the config "editor.yaml"
|
Given we use the config "editor.yaml"
|
||||||
When we run "jrnl --override '{\"editor\": \"nano\"}'"
|
When we run "jrnl --config-override '{\"editor\": \"nano\"}'"
|
||||||
Then the editor "nano" should have been called
|
Then the editor "nano" should have been called
|
||||||
|
|
||||||
Scenario: Override configured linewrap with a value of 23
|
Scenario: Override configured linewrap with a value of 23
|
||||||
Given we use the config "editor.yaml"
|
Given we use the config "editor.yaml"
|
||||||
When we run "jrnl -2 --override '{"linewrap": 23}' --format fancy"
|
When we run "jrnl -2 --config-override '{"linewrap": 23}' --format fancy"
|
||||||
Then the output should be
|
Then the output should be
|
||||||
"""
|
"""
|
||||||
┎─────╮2013-06-09 15:39
|
┎─────╮2013-06-09 15:39
|
||||||
|
|
|
@ -232,7 +232,7 @@ def editor_override(context, editor):
|
||||||
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
|
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
|
||||||
:
|
:
|
||||||
try :
|
try :
|
||||||
cli(['--override','{"editor": "%s"}'%editor])
|
cli(['--config-override','{"editor": "%s"}'%editor])
|
||||||
context.exit_status = 0
|
context.exit_status = 0
|
||||||
context.editor = mock_editor
|
context.editor = mock_editor
|
||||||
assert mock_editor.assert_called_once_with(editor, context.tmpfile)
|
assert mock_editor.assert_called_once_with(editor, context.tmpfile)
|
||||||
|
|
|
@ -320,7 +320,7 @@ def parse_args(args=[]):
|
||||||
textwrap.dedent("These are one-off overrides of the config file options"),
|
textwrap.dedent("These are one-off overrides of the config file options"),
|
||||||
)
|
)
|
||||||
overrides.add_argument(
|
overrides.add_argument(
|
||||||
"--override",
|
"--config-override",
|
||||||
dest="config_override",
|
dest="config_override",
|
||||||
action="store",
|
action="store",
|
||||||
type=json.loads,
|
type=json.loads,
|
||||||
|
@ -331,7 +331,7 @@ def parse_args(args=[]):
|
||||||
Override configured key-value pairs with CONFIG_KV_PAIR for this command invocation only.
|
Override configured key-value pairs with CONFIG_KV_PAIR for this command invocation only.
|
||||||
|
|
||||||
For example, to use a different editor for this jrnl entry, call:
|
For example, to use a different editor for this jrnl entry, call:
|
||||||
jrnl --override '{"editor": "nano"}'
|
jrnl --config-override '{"editor": "nano"}'
|
||||||
|
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
|
@ -40,7 +40,7 @@ def test_override_configured_editor(
|
||||||
mock_load_or_install.return_value = minimal_config
|
mock_load_or_install.return_value = minimal_config
|
||||||
mock_isatty.return_value = True
|
mock_isatty.return_value = True
|
||||||
|
|
||||||
cli_args = ["--override", '{"editor": "nano"}']
|
cli_args = ["--config-override", '{"editor": "nano"}']
|
||||||
parser = parse_args(cli_args)
|
parser = parse_args(cli_args)
|
||||||
assert parser.config_override.__len__() == 1
|
assert parser.config_override.__len__() == 1
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ def test_version_alone():
|
||||||
|
|
||||||
def test_editor_override():
|
def test_editor_override():
|
||||||
|
|
||||||
assert cli_as_dict('--override \'{"editor": "nano"}\'') == expected_args(
|
assert cli_as_dict('--config-override \'{"editor": "nano"}\'') == expected_args(
|
||||||
config_override={"editor": "nano"}
|
config_override={"editor": "nano"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue