From 77fba4e9add73983a9795e40733ef386053b72d9 Mon Sep 17 00:00:00 2001 From: Kwabena Amponsah Date: Tue, 11 Aug 2026 21:24:13 +0100 Subject: [PATCH] Add CPPWG_DEFAULT_LOGFILE constant for the default log file name The default --logfile value was a bare "cppwg.log" literal in the argparse setup. Move it to constants.py (as f"{CPPWG_EXT}.log") alongside the other filename constants like CPPWG_HEADER_COLLECTION_FILENAME, and reference it as the argument's const, so the name lives in one place. Co-Authored-By: Claude Opus 4.8 --- cppwg/__main__.py | 3 ++- cppwg/utils/constants.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cppwg/__main__.py b/cppwg/__main__.py index cf39d0ee..0c7293c7 100644 --- a/cppwg/__main__.py +++ b/cppwg/__main__.py @@ -6,6 +6,7 @@ from pathlib import Path from cppwg import CppWrapperGenerator +from cppwg.utils.constants import CPPWG_DEFAULT_LOGFILE from cppwg.version import __version__ @@ -132,7 +133,7 @@ def parse_args() -> argparse.Namespace: type=str, nargs="?", default=None, - const="cppwg.log", + const=CPPWG_DEFAULT_LOGFILE, help="Output log messages to a file.", ) diff --git a/cppwg/utils/constants.py b/cppwg/utils/constants.py index 14ecc247..c52527bd 100644 --- a/cppwg/utils/constants.py +++ b/cppwg/utils/constants.py @@ -6,6 +6,9 @@ CPPWG_EXT = "cppwg" CPPWG_HEADER_COLLECTION_FILENAME = f"wrapper_header_collection.{CPPWG_EXT}.hpp" +# Default log file name used when --logfile is passed without a value. +CPPWG_DEFAULT_LOGFILE = f"{CPPWG_EXT}.log" + CPPWG_TRUE_STRINGS = ["ON", "YES", "Y", "TRUE", "T", "1"] CPPWG_FALSE_STRINGS = ["OFF", "NO", "N", "FALSE", "F", "0", ""]