Skip to content

Commit 4a6ffea

Browse files
authored
Add --no-git-check option to skip confirmation dialog for scan-folder (#348)
* Add --no-git-check option to skip confirmation dialog for scan-folder * Add CHANGELOG entry * Fix code style * Change wording for git-check option
1 parent 22ebf02 commit 4a6ffea

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Features:
1212
* Rebase container to python 3.11
1313
* Add CI step to verify container is operational
1414

15+
* [#348](https://github.com/godaddy/tartufo/pull/348) - Add --no-git-check option
16+
to skip confirmation dialog for scan-folder
17+
1518
v3.3.1 - 23 Nov 2022
1619
--------------------
1720

tartufo/commands/scan_folder.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,30 @@
1414
show_default=True,
1515
help="Recurse and scan the entire folder",
1616
)
17+
@click.option(
18+
"--git-check/--no-git-check",
19+
is_flag=True,
20+
default=True,
21+
show_default=True,
22+
help="Skip check if the folder is a git repo",
23+
)
1724
@click.argument(
1825
"target",
1926
type=click.Path(exists=True, file_okay=False, resolve_path=True, allow_dash=False),
2027
)
2128
@click.pass_obj
2229
@click.pass_context
2330
def main(
24-
ctx: click.Context, options: types.GlobalOptions, target: str, recurse: bool
31+
ctx: click.Context,
32+
options: types.GlobalOptions,
33+
target: str,
34+
recurse: bool,
35+
git_check: bool,
2536
) -> FolderScanner:
2637
"""Scan a folder."""
2738
try:
2839
resume: bool = True
29-
if util.path_contains_git(target) is True:
40+
if git_check and util.path_contains_git(target) is True:
3041
resume = click.confirm(
3142
"This folder is a git repository, and should be scanned using the "
3243
"scan-local-repo command. Are you sure you wish to proceed?"

0 commit comments

Comments
 (0)