Open Grueslayer opened 3 months ago
Thanks for the PR. I like the idea of the caption.
I think the caption and file name are too tightly coupled at the moment. The idea of computing the file name directly from the caption in a non-configurable (and opinionated) way is not flexible enough. This should be configurable by the user.
I suggest you make the following changes:
$CAPTION
and prompt_for_caption
options. caption
configuration option. This way, users can auto generate captions (through lua functions) if they wish, similar to the file_name
option.get_opt
function, i.e. config.get_opt("file_name", { caption = caption })
. This way, users can generate the file name from the caption through the configuration. get_file_path_and_caption
should be split into two functions: get_file_path
(original implementation) and get_caption
. They should be entirely decoupled to decrease complexity for the sake of maintainability. This approach should allow more or less full flexibility to the user.
Let me know if you have any questions or if there's anything else I can assist with. I'm definitely open to merging this PR if you make the above changes!
Related issue
Can be a possible solution for #76
Summary of changes
New option
prompt_for_caption
shows a prompt, creates a filename from it and replaces$CAPTION
in template. Ifprompt_for_file_name
is also given, the suggested filename is already available in prompt.This works fine for me: