Adding CLI parameters : --add-suffix and --exclude-drafts
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user