Skip to content

Commit

Permalink
feat: ✨ Move excludes option to check and scan commands (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderleek authored Dec 7, 2024
1 parent 2517028 commit d5ea049
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions codelimit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@ def list_commands(self, ctx: Context):
@cli.command(help="Check file(s)")
def check(
paths: Annotated[List[Path], typer.Argument(exists=True)],
exclude: Annotated[
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
] = None,
quiet: Annotated[
bool, typer.Option("--quiet", help="No output when successful")
] = False,
):
if exclude:
Configuration.excludes.extend(exclude)
check_command(paths, quiet)


@cli.command(help="Scan a codebase")
def scan(
path: Annotated[
Path, typer.Argument(exists=True, file_okay=False, help="Codebase root")
] = Path(".")
] = Path("."),
exclude: Annotated[
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
] = None
):
if exclude:
Configuration.excludes.extend(exclude)
scan_command(path)


Expand Down Expand Up @@ -68,9 +78,6 @@ def main(
verbose: Annotated[
Optional[bool], typer.Option("--verbose", "-v", help="Verbose output")
] = False,
exclude: Annotated[
Optional[list[str]], typer.Option(help="Glob patterns for exclusion")
] = None,
version: Annotated[
Optional[bool],
typer.Option(
Expand All @@ -83,8 +90,6 @@ def main(
Configuration.verbose = True
if version:
raise typer.Exit()
if exclude:
Configuration.excludes.extend(exclude)


if __name__ == "__main__":
Expand Down

0 comments on commit d5ea049

Please sign in to comment.