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:
Aaron Lichtman 2023-03-25 11:47:00 -07:00 committed by GitHub
parent 0725ea6b87
commit a2b217fdfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 217 additions and 68 deletions

View file

@ -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)