Adding CLI parameters : --add-suffix and --exclude-drafts

This commit is contained in:
2026-05-07 00:19:58 +01:00
parent 123e9d3338
commit ad0ebb307d
4 changed files with 73 additions and 29 deletions

View File

@@ -220,6 +220,27 @@ def get_dashboard_config_path(config_file_name):
return os.path.join(get_config_path(), config_file_name)
_output_file_suffix = None
def set_output_file_suffix(suffix):
"""Sets the global output file suffix (used by --add-suffix CLI arg)."""
global _output_file_suffix
_output_file_suffix = suffix
def get_output_filename(base_name):
"""Returns the output filename with the suffix inserted before the extension.
Example: get_output_filename("endobest_inclusions.json") with suffix "A"
"endobest_inclusions_A.json"
"""
if not _output_file_suffix:
return base_name
name, ext = os.path.splitext(base_name)
return f"{name}_{_output_file_suffix}{ext}"
def get_old_filename(current_filename, old_suffix="_old"):
"""Generate old backup filename from current filename.