fix(cli,mine): shell-quote project_dir in resume hints
The "Skipped. Run mempalace mine <dir>" hint after declining the init prompt and the "Re-run mempalace mine <dir> to resume" hint after a Ctrl-C interruption both interpolated project_dir without shell-quoting. A path containing spaces or metacharacters produced a copy-paste-broken command. Both spots now use shlex.quote(project_dir). Adds regression tests covering each hint with a path that contains a space.
This commit is contained in:
+1
-1
@@ -238,7 +238,7 @@ def _maybe_run_mine_after_init(args, cfg) -> None:
|
||||
# we don't block. User can re-run with --auto-mine to opt in.
|
||||
answer = "n"
|
||||
if answer not in ("", "y", "yes"):
|
||||
print(f"\n Skipped. Run `mempalace mine {project_dir}` when ready.")
|
||||
print(f"\n Skipped. Run `mempalace mine {shlex.quote(project_dir)}` when ready.")
|
||||
return
|
||||
|
||||
palace_path = cfg.palace_path
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ Stores verbatim chunks as drawers. No summaries. Ever.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shlex
|
||||
import hashlib
|
||||
import fnmatch
|
||||
from pathlib import Path
|
||||
@@ -1103,7 +1104,7 @@ def mine(
|
||||
print(f" drawers_filed: {total_drawers}")
|
||||
print(f" last_file: {last_file or '<none>'}")
|
||||
print(
|
||||
f"\n Re-run `mempalace mine {project_dir}` to resume — "
|
||||
f"\n Re-run `mempalace mine {shlex.quote(project_dir)}` to resume — "
|
||||
"already-filed drawers are\n upserted idempotently and will not duplicate.\n"
|
||||
)
|
||||
sys.exit(130)
|
||||
|
||||
Reference in New Issue
Block a user