fix: tab completion on custom file-path prompts

The "p. Enter a custom path" branches of the OMEN and Markov training
pickers, the combipow wordlist prompt, and the rule cleanup/optimize
output-path prompts used a bare input() with no readline completer, so
TAB did nothing. Route them through select_file_with_autocomplete.

Also drop the path completer after each selection so later numeric-menu
and y/n prompts don't inherit stale file-path tab completion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-07-25 16:16:06 -04:00
co-authored by Claude Opus 4.8
parent 9db39be438
commit a7233c2f4f
7 changed files with 188 additions and 32 deletions
+3 -1
View File
@@ -355,12 +355,14 @@ class TestOmenAttackHandler:
def test_custom_path_for_training(self, tmp_path):
ctx = self._make_ctx(tmp_path, model_valid=False)
self._setup_rules_dir(tmp_path)
ctx.select_file_with_autocomplete.return_value = "/custom/wordlist.txt"
with patch("os.path.isfile", return_value=True), patch(
"builtins.input", side_effect=["p", "/custom/wordlist.txt", "", "0"]
"builtins.input", side_effect=["p", "", "0"]
):
from hate_crack.attacks import omen_attack
omen_attack(ctx)
ctx.select_file_with_autocomplete.assert_called_once()
ctx.hcatOmenTrain.assert_called_once_with("/custom/wordlist.txt")
def test_rules_passed_to_hcatOmen(self, tmp_path):