From 0a33a71b36d64e78622d22400e50ebb3b732c52b Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 28 Oct 2025 10:53:10 +0100 Subject: add default sources config option --- patchtree/cli.py | 5 ++++- patchtree/config.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/patchtree/cli.py b/patchtree/cli.py index 8e923dd..9ddb4fb 100644 --- a/patchtree/cli.py +++ b/patchtree/cli.py @@ -46,7 +46,7 @@ def parse_arguments(config: Config) -> Context: action="store_true", ) parser.add_argument("target", help="target directory or archive") - parser.add_argument("patch", help="patch input glob(s)", nargs="+") + parser.add_argument("patch", help="patch input glob(s)", nargs="*") options = parser.parse_args() @@ -56,6 +56,9 @@ def parse_arguments(config: Config) -> Context: if options.shebang: config.output_shebang = True + if len(options.patch) == 0: + options.patch = config.default_patch_sources + try: return config.context(config, options) except Exception as e: diff --git a/patchtree/config.py b/patchtree/config.py index 94b7cc9..fbe78e9 100644 --- a/patchtree/config.py +++ b/patchtree/config.py @@ -95,5 +95,8 @@ class Config: """Whether to output a shebang line with the ``git patch`` command to apply the patch.""" + default_patch_sources: list[str] = field(default_factory=list) + """List of default sources.""" + def __post_init__(self): self.processors = {**DEFAULT_PROCESSORS, **self.processors} -- cgit v1.2.3