Skip to content

Commit 6e25eab

Browse files
[FR] Add --force flag to update-lock-versions (#3693)
* Add --force flag to update-lock-versions * Add type hinting (cherry picked from commit 707ca32)
1 parent 0e8cce2 commit 6e25eab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

detection_rules/devtools.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ def prune_staging_area(target_stack_version: str, dry_run: bool, exception_list:
334334

335335
@dev_group.command('update-lock-versions')
336336
@click.argument('rule-ids', nargs=-1, required=False)
337-
def update_lock_versions(rule_ids):
337+
@click.option('--force', is_flag=True, help='Force update without confirmation')
338+
def update_lock_versions(rule_ids: Tuple[str, ...], force: bool):
338339
"""Update rule hashes in version.lock.json file without bumping version."""
339340
rules = RuleCollection.default()
340341

@@ -343,7 +344,9 @@ def update_lock_versions(rule_ids):
343344
else:
344345
rules = rules.filter(production_filter)
345346

346-
if not click.confirm(f'Are you sure you want to update hashes for {len(rules)} rules without a version bump?'):
347+
if not force and not click.confirm(
348+
f'Are you sure you want to update hashes for {len(rules)} rules without a version bump?'
349+
):
347350
return
348351

349352
# this command may not function as expected anymore due to previous changes eliminating the use of add_new=False

0 commit comments

Comments
 (0)