diff options
| author | Loek Le Blansch <loek.le-blansch.pv@renesas.com> | 2025-10-28 10:53:10 +0100 |
|---|---|---|
| committer | Loek Le Blansch <loek.le-blansch.pv@renesas.com> | 2025-10-28 10:53:10 +0100 |
| commit | 0a33a71b36d64e78622d22400e50ebb3b732c52b (patch) | |
| tree | 6e257eecd92ef0998ec1d8fa0b8ff78da6ead0f4 | |
| parent | 6afd73e8d1b3aba83799990b5f1afb7f2c36bca3 (diff) | |
add default sources config option
| -rw-r--r-- | patchtree/cli.py | 5 | ||||
| -rw-r--r-- | patchtree/config.py | 3 |
2 files changed, 7 insertions, 1 deletions
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} |