mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Fix bug that prevented --format pretty and --format short from working (#1177)
This commit is contained in:
parent
b9a6d029e2
commit
a3f4f6b944
7 changed files with 79 additions and 2 deletions
|
@ -1,5 +1,31 @@
|
|||
Feature: Custom formats
|
||||
|
||||
Scenario Outline: Short printing via --format flag
|
||||
Given We use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --format short -3"
|
||||
Then we should get no error
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: Pretty Printing aka the Default
|
||||
Given We use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --format pretty -3"
|
||||
Then we should get no error
|
||||
|
||||
Examples: configs
|
||||
| config |
|
||||
| basic_onefile |
|
||||
| basic_encrypted |
|
||||
| basic_folder |
|
||||
| basic_dayone |
|
||||
|
||||
Scenario Outline: JSON format
|
||||
Given we use the config "<config>.yaml"
|
||||
And we use the password "test" if prompted
|
||||
|
|
|
@ -407,6 +407,12 @@ def all_input_was_used(context):
|
|||
def run(context, command, text=""):
|
||||
text = text or context.text or ""
|
||||
|
||||
if "config_path" in context and context.config_path is not None:
|
||||
with open(context.config_path) as f:
|
||||
context.jrnl_config = yaml.load(f, Loader=yaml.FullLoader)
|
||||
else:
|
||||
context.jrnl_config = None
|
||||
|
||||
if "cache_dir" in context and context.cache_dir is not None:
|
||||
cache_dir = os.path.join("features", "cache", context.cache_dir)
|
||||
command = command.format(cache_dir=cache_dir)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
import string
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from behave import given
|
||||
from behave import then
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue