mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Add ability to use template with --template
(#1667)
* Add ability to pass template path with --template Update jrnl/args.py * Fix tests
This commit is contained in:
parent
0725ea6b87
commit
a2b217fdfc
12 changed files with 217 additions and 68 deletions
|
@ -125,6 +125,19 @@ def we_use_the_config(request, temp_dir, working_dir, config_file):
|
|||
return config_dest
|
||||
|
||||
|
||||
@given(parse('we copy the template "{template_file}" to the default templates folder'), target_fixture="default_templates_path")
|
||||
def we_copy_the_template(request, temp_dir, working_dir, template_file):
|
||||
# Move into temp dir as cwd
|
||||
os.chdir(temp_dir.name) # @todo move this step to a more universal place
|
||||
|
||||
# Copy template over
|
||||
template_source = os.path.join(working_dir, "data", "templates", template_file)
|
||||
template_dest = os.path.join(temp_dir.name, "templates", template_file)
|
||||
os.makedirs(os.path.dirname(template_dest), exist_ok=True)
|
||||
shutil.copy2(template_source, template_dest)
|
||||
return template_dest
|
||||
|
||||
|
||||
@given(parse('the config "{config_file}" exists'), target_fixture="config_path")
|
||||
def config_exists(config_file, temp_dir, working_dir):
|
||||
config_source = os.path.join(working_dir, "data", "configs", config_file)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue