Skip to content

Commit d5ea049

Browse files
feat: ✨ Move excludes option to check and scan commands (#47)
1 parent 2517028 commit d5ea049

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

codelimit/__main__.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,29 @@ def list_commands(self, ctx: Context):
2727
@cli.command(help="Check file(s)")
2828
def check(
2929
paths: Annotated[List[Path], typer.Argument(exists=True)],
30+
exclude: Annotated[
31+
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
32+
] = None,
3033
quiet: Annotated[
3134
bool, typer.Option("--quiet", help="No output when successful")
3235
] = False,
3336
):
37+
if exclude:
38+
Configuration.excludes.extend(exclude)
3439
check_command(paths, quiet)
3540

3641

3742
@cli.command(help="Scan a codebase")
3843
def scan(
3944
path: Annotated[
4045
Path, typer.Argument(exists=True, file_okay=False, help="Codebase root")
41-
] = Path(".")
46+
] = Path("."),
47+
exclude: Annotated[
48+
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
49+
] = None
4250
):
51+
if exclude:
52+
Configuration.excludes.extend(exclude)
4353
scan_command(path)
4454

4555

@@ -68,9 +78,6 @@ def main(
6878
verbose: Annotated[
6979
Optional[bool], typer.Option("--verbose", "-v", help="Verbose output")
7080
] = False,
71-
exclude: Annotated[
72-
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
73-
] = None,
7481
version: Annotated[
7582
Optional[bool],
7683
typer.Option(
@@ -83,8 +90,6 @@ def main(
8390
Configuration.verbose = True
8491
if version:
8592
raise typer.Exit()
86-
if exclude:
87-
Configuration.excludes.extend(exclude)
8893

8994

9095
if __name__ == "__main__":

0 commit comments

Comments
 (0)