Allow custom extensions when editing (for easier syntax highlighting) (#1139)

* Create tests and steps for temporary filename suffix
* Have temporary filename suffix be -{template_filename} or .jrnl
* Finalize extension_editor_file
* Make suffix local variable in get_text_from_editor
This commit is contained in:
Karim Rahal 2021-01-02 23:23:15 +02:00 committed by GitHub
parent c47c1e209e
commit e9fd5cdc0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 1 deletions

View file

@ -248,6 +248,14 @@ def contains_editor_file(context, method, text=""):
assert False, f"Method '{method}' not supported"
@then('the temporary filename suffix should be "{suffix}"')
def extension_editor_file(context, suffix):
filename = Path(context.editor_file["name"]).name
delimiter = "-" if "-" in filename else "."
filename_suffix = delimiter + filename.split(delimiter)[-1]
assert filename_suffix == suffix
def _mock_getpass(inputs):
def prompt_return(prompt=""):
if type(inputs) == str: