Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-git-check option to skip confirmation dialog for scan-folder #348

Merged
merged 4 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Features:
* Rebase container to python 3.11
* Add CI step to verify container is operational

* [#348](https://github.com/godaddy/tartufo/pull/348) - Add --no-git-check option
to skip confirmation dialog for scan-folder

v3.3.1 - 23 Nov 2022
--------------------

Expand Down
15 changes: 13 additions & 2 deletions tartufo/commands/scan_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,30 @@
show_default=True,
help="Recurse and scan the entire folder",
)
@click.option(
"--git-check/--no-git-check",
is_flag=True,
default=True,
show_default=True,
help="Skip check if the folder is a git repo",
)
@click.argument(
"target",
type=click.Path(exists=True, file_okay=False, resolve_path=True, allow_dash=False),
)
@click.pass_obj
@click.pass_context
def main(
ctx: click.Context, options: types.GlobalOptions, target: str, recurse: bool
ctx: click.Context,
options: types.GlobalOptions,
target: str,
recurse: bool,
git_check: bool,
) -> FolderScanner:
"""Scan a folder."""
try:
resume: bool = True
if util.path_contains_git(target) is True:
if git_check and util.path_contains_git(target) is True:
resume = click.confirm(
"This folder is a git repository, and should be scanned using the "
"scan-local-repo command. Are you sure you wish to proceed?"
Expand Down