aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patchtree/cli.py5
-rw-r--r--patchtree/config.py3
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}