feat: Add output_template configuration option and add a test module #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new feature is a new configuration option for automatic naming of key/csr/crt files. With the current changes the new configuration in applicable to request and download commands. If the option is not configured or a custom output-filename is provided the outputh filepath is obtained with a join on output_folder, as before.
The new config option output_template is a template string that can be used for organizing certificate files in subfolders and/or to add date stamps on saved files in order to maintain a repository with many certificates and along time. I tried to keep the previous behavior if the configuration is not added.
If the feature is of some interest I could keep working on applying the new configuration to other commands (smime) and add other tests for commands before the merge.
I've also added an argument to main() in order to simplify the tests on various commands.
Other ideas that could be interesting in order to extend the tool is the option of make the package/commands importable by a module and reorganizing fatal errors (
exit(1)) with a custom exception that is intercepted by main.thanks
Davide