diff --git a/burocrata/cli.py b/burocrata/cli.py index 4847632..9048ec1 100644 --- a/burocrata/cli.py +++ b/burocrata/cli.py @@ -40,13 +40,21 @@ show_default=True, help="Print information during execution / Don't print", ) +@click.option( + "--ignore", + "-i", + default=None, + show_default=True, + help="A comma separated list of directories to ignore during the analysis ", + +) @click.version_option() @click.argument( "directories", type=click.Path(exists=True, file_okay=False, path_type=pathlib.Path), nargs=-1, ) -def main(extension, check, verbose, directories): +def main(extension, check, verbose, directories, ignore): """ Burocrata: Check and insert copyright and license notices into source code @@ -84,7 +92,12 @@ def main(extension, check, verbose, directories): exclude = config["tool"]["burocrata"]["exclude"] exclude = pathspec.PathSpec.from_lines("gitwildmatch", exclude) ######## - + if ignore: + ignore = ignore.split(",") + print(ignore) + ignore = [i for i in ignore] + ignore = pathspec.PathSpec.from_lines("gitwildmatch", ignore) + gitignore = get_gitignore() missing_notice = [] @@ -96,6 +109,9 @@ def main(extension, check, verbose, directories): continue if exclude.match_file(path): continue + if ignore: + if ignore.match_file(path): + continue amount += 1 source_code = path.read_text().split("\n") if not source_code: