Description of the desired feature:
Currently, burocrata expects a directory to be passed as argument to the CLI. It would be nice if we could alternatively pass a single file to it.
We should be checking if the passed argument is a file or a directory and then act accordingly.
If the passed argument is a file, I think we can safely ignore the --extension option.
Maybe we can refactor the main function and move these lines to their own private function that will return the list of missing files. In case the passed argument is a file, then the function should just check if the file lacks the license notice or not:
|
missing_notice = [] |
|
for directory in directories: |
|
amount = 0 |
|
for ext in extensions: |
|
for path in directory.glob(f"**/*.{ext}"): |
|
if gitignore.match_file(path): |
|
continue |
|
amount += 1 |
|
source_code = path.read_text().split("\n") |
|
if not source_code: |
|
missing_notice.append(path) |
|
else: |
|
for notice_line, file_line in zip(notice, source_code): |
|
if notice_line != file_line: |
|
missing_notice.append(path) |
|
break |
Are you willing to help implement and maintain this feature?
I'll be glad to!
Description of the desired feature:
Currently, burocrata expects a directory to be passed as argument to the CLI. It would be nice if we could alternatively pass a single file to it.
We should be checking if the passed argument is a file or a directory and then act accordingly.
If the passed argument is a file, I think we can safely ignore the
--extensionoption.Maybe we can refactor the
mainfunction and move these lines to their own private function that will return the list of missing files. In case the passed argument is a file, then the function should just check if the file lacks the license notice or not:burocrata/burocrata/cli.py
Lines 84 to 99 in 119839f
Are you willing to help implement and maintain this feature?
I'll be glad to!