From d5ea049f37327d8b1c3c5de0829a2d97e89b5347 Mon Sep 17 00:00:00 2001 From: Rob van der Leek <5324924+robvanderleek@users.noreply.github.com> Date: Sat, 7 Dec 2024 08:12:13 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Move=20excludes=20option=20?= =?UTF-8?q?to=20check=20and=20scan=20commands=20(#47)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codelimit/__main__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/codelimit/__main__.py b/codelimit/__main__.py index 1453bd3..5318a2d 100755 --- a/codelimit/__main__.py +++ b/codelimit/__main__.py @@ -27,10 +27,15 @@ 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) @@ -38,8 +43,13 @@ def check( 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) @@ -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( @@ -83,8 +90,6 @@ def main( Configuration.verbose = True if version: raise typer.Exit() - if exclude: - Configuration.excludes.extend(exclude) if __name__ == "__main__":