improve filtering
This commit is contained in:
parent
c5be0e1e3d
commit
eb275988bd
1 changed files with 11 additions and 4 deletions
|
@ -31,8 +31,10 @@ class ArgumentParser(Tap):
|
||||||
"repository mirror interval"
|
"repository mirror interval"
|
||||||
log: str = "INFO"
|
log: str = "INFO"
|
||||||
"log level"
|
"log level"
|
||||||
filter: str | None = None
|
include: str | None = None
|
||||||
"filter repositories by this regular expression"
|
"include repositories by this regular expression"
|
||||||
|
exclude: str | None = None
|
||||||
|
"exclude repositories by this regular expression"
|
||||||
immediate: bool = False
|
immediate: bool = False
|
||||||
"tell Forgejo to mirror Git repositories immediately"
|
"tell Forgejo to mirror Git repositories immediately"
|
||||||
sync_on_commit: bool = False
|
sync_on_commit: bool = False
|
||||||
|
@ -144,8 +146,13 @@ def main() -> None:
|
||||||
repo=repo.name,
|
repo=repo.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
if args.filter is not None:
|
if args.include is not None:
|
||||||
pattern = compile(args.filter)
|
pattern = compile(args.include)
|
||||||
|
if pattern.search(repo.name) is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if args.exclude is not None:
|
||||||
|
pattern = compile(args.exclude)
|
||||||
if pattern.search(repo.name) is not None:
|
if pattern.search(repo.name) is not None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue