Adding CLI parameters : --add-suffix and --exclude-drafts
This commit is contained in:
@@ -34,7 +34,7 @@ try:
|
||||
except ImportError:
|
||||
xw = None
|
||||
|
||||
from eb_dashboard_utils import get_nested_value, get_config_path, get_dashboard_config_path
|
||||
from eb_dashboard_utils import get_nested_value, get_config_path, get_dashboard_config_path, get_output_filename
|
||||
from eb_dashboard_constants import (
|
||||
INCLUSIONS_FILE_NAME,
|
||||
ORGANIZATIONS_FILE_NAME,
|
||||
@@ -399,7 +399,7 @@ def export_to_excel(inclusions_data, organizations_data, excel_config,
|
||||
output_template = workbook_config.get("output_file_name_template")
|
||||
if_output_exists = workbook_config.get("if_output_exists", OUTPUT_ACTION_OVERWRITE)
|
||||
|
||||
# Resolve output filename
|
||||
# Resolve output filename, then apply --add-suffix if provided
|
||||
try:
|
||||
output_filename = output_template.format(**template_vars)
|
||||
except KeyError as e:
|
||||
@@ -407,6 +407,7 @@ def export_to_excel(inclusions_data, organizations_data, excel_config,
|
||||
error_count += 1
|
||||
continue
|
||||
|
||||
output_filename = get_output_filename(output_filename)
|
||||
output_path = os.path.join(EXCEL_OUTPUT_FOLDER, output_filename)
|
||||
|
||||
# Log workbook processing start
|
||||
@@ -556,7 +557,7 @@ def _prepare_template_variables():
|
||||
"""
|
||||
# Get UTC timestamp from inclusions file
|
||||
# Use constant from eb_dashboard_constants (SINGLE SOURCE OF TRUTH)
|
||||
inclusions_file = INCLUSIONS_FILE_NAME
|
||||
inclusions_file = get_output_filename(INCLUSIONS_FILE_NAME)
|
||||
if os.path.exists(inclusions_file):
|
||||
file_mtime = os.path.getmtime(inclusions_file)
|
||||
extract_date_time_utc = datetime.fromtimestamp(file_mtime, tz=timezone.utc)
|
||||
@@ -1921,9 +1922,9 @@ def export_excel_only(sys_argv,
|
||||
global console
|
||||
|
||||
if not inclusions_filename:
|
||||
inclusions_filename = INCLUSIONS_FILE_NAME
|
||||
inclusions_filename = get_output_filename(INCLUSIONS_FILE_NAME)
|
||||
if not organizations_filename:
|
||||
organizations_filename = ORGANIZATIONS_FILE_NAME
|
||||
organizations_filename = get_output_filename(ORGANIZATIONS_FILE_NAME)
|
||||
|
||||
print()
|
||||
console.print("[bold cyan]═══ EXCEL ONLY MODE ═══[/bold cyan]\n")
|
||||
@@ -2038,8 +2039,8 @@ def run_normal_mode_export(excel_enabled, excel_config,
|
||||
try:
|
||||
# Load JSONs from filesystem to ensure data consistency with what was written
|
||||
# Use constants imported from eb_dashboard_constants.py (SINGLE SOURCE OF TRUTH)
|
||||
inclusions_from_fs = _load_json_file_internal(INCLUSIONS_FILE_NAME)
|
||||
organizations_from_fs = _load_json_file_internal(ORGANIZATIONS_FILE_NAME)
|
||||
inclusions_from_fs = _load_json_file_internal(get_output_filename(INCLUSIONS_FILE_NAME))
|
||||
organizations_from_fs = _load_json_file_internal(get_output_filename(ORGANIZATIONS_FILE_NAME))
|
||||
|
||||
if inclusions_from_fs is None or organizations_from_fs is None:
|
||||
error_msg = "Could not load data files for Excel export"
|
||||
|
||||
Reference in New Issue
Block a user