fix(blocks): make BATTMAN work instead of erroring like ATTMAN (#295)

BATTMAN matched the ATTMAN command arm but the argument was extracted
with `cmd.trim_start_matches("ATTMAN")`. "BATTMAN" has no leading
"ATTMAN" to strip, so the whole word survived as a bogus block-name
argument — BATTMAN always reported "ATTMAN: no matching block" instead
of listing attributes. `BATTMAN <name>` never matched at all.

Strip whichever keyword was actually typed (BATTMAN first, since ATTMAN
is a suffix of it) with `strip_prefix`, and match the `BATTMAN ` prefix
form too. BATTMAN now behaves identically to ATTMAN.

Adds headless regression tests driving the real dispatcher; they fail on
the previous code with the reported symptom and pass with the fix.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Kevin GriffinandClaude Opus 4.8 committed 2026-07-10 15:06:12 -07:00
1 parent 5c4ba97c5f
commit 0f6999a838
2 files changed
+103 -3

No files matched your search

+1 -1
View File
@@ -194,7 +194,7 @@ Status of every standard CAD command in Open CAD Studio:
| `ATTEXT` | — | Extract attributes (legacy) | ✅ |
| `ATTSYNC` | — | Synchronize attribute definitions | ✅ |
| `BLOCKPALETTE` | — | Multi-view block palette (command-line list) | 🔶 |
| `ATTMAN` | — | Attribute manager (command-line list) | 🔶 |
| `ATTMAN` | `BATTMAN` | Attribute manager (command-line list) | 🔶 |
| `XBIND` | XB | Bind xref elements to drawing | ❌ |
| `XOPEN` | — | Open xref for editing | ✅ |
| `BSAVE` | — | Save block in editor | ❌ |