mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Give a proper message when trying to use an empty config file (#1461)
* Added check for empty config file and if so, use default config * Added check for empty config file and if so, use default config * Fix and add tests for empty config file * Exit program with message if config is empty. bdd-test doesn't add version if file is (and should stay) empty. * Exit program with message if config is empty. * bdd-test doesn't add version if file is (and should stay) empty. Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
71c1d38d50
commit
792f188ecc
4 changed files with 20 additions and 2 deletions
|
@ -101,7 +101,11 @@ def we_use_the_config(request, temp_dir, working_dir):
|
|||
|
||||
# @todo get rid of this by using default config values
|
||||
# merge in version number
|
||||
if config_file.endswith("yaml") and os.path.exists(config_dest):
|
||||
if (
|
||||
config_file.endswith("yaml")
|
||||
and os.path.exists(config_dest)
|
||||
and os.path.getsize(config_dest) > 0
|
||||
):
|
||||
# Add jrnl version to file for 2.x journals
|
||||
with open(config_dest, "a") as cf:
|
||||
cf.write("version: {}".format(__version__))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue