fix(kvb-org-operator): list only runnable rows in the bash block
Legacy register rows carry a prose title and no directory. They stay in the table but no longer land in the copy-paste bash block as if they were commands; with no runnable row the block is omitted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b4c4cefadd
commit
997a01ccfa
2 files changed
+18
-8
No files matched your search
@@ -226,14 +226,15 @@ def cmd_list(rasci: ModuleType, args: argparse.Namespace) -> int:
|
||||
for number, row in enumerate(listed, 1):
|
||||
values = (number, row["directory"] or "-", row["command"] or "-", row["why"] or "-", row["check"])
|
||||
print("| " + " | ".join(cell(v) for v in values) + " |")
|
||||
print()
|
||||
print("```bash")
|
||||
for row in listed:
|
||||
if row["directory"]:
|
||||
# Trip-wire: legacy rows carry a prose title and no directory; only rows recorded by `add` are commands.
|
||||
runnable = [row for row in listed if row["directory"] and row["command"]]
|
||||
if runnable:
|
||||
print()
|
||||
print("```bash")
|
||||
for row in runnable:
|
||||
print(f"cd {shlex.quote(row['directory'])}")
|
||||
if row["command"]:
|
||||
print(row["command"])
|
||||
print("```")
|
||||
print("```")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user