mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-06 21:02:04 +00:00
tui2: add full in-app palette command reference
This commit is contained in:
1 parent
949d87dd4f
commit
3f0d4a8d89
6 files changed
+107
-23
No files matched your search
+53
-19
@@ -282,6 +282,7 @@ def launch_tui2(
|
||||
yield Input(
|
||||
placeholder=(
|
||||
"Command palette: help | open <id> | search <q> | "
|
||||
"help-commands | "
|
||||
"filter <kind> | archive | restore | "
|
||||
"archive-filter <active|all|archived> | "
|
||||
"add-password <label> <length> [username] [url] | "
|
||||
@@ -489,6 +490,46 @@ def launch_tui2(
|
||||
def _set_secret_panel(self, text: str) -> None:
|
||||
self.query_one("#secret-detail", Static).update(text)
|
||||
|
||||
def _palette_help_summary(self) -> str:
|
||||
return (
|
||||
"Palette commands: help, help-commands, open, search, filter, "
|
||||
"archive, restore, archive-filter, edit-doc/save-doc/cancel-edit, "
|
||||
"link-add/link-rm/link-filter/link-next/link-prev/link-open, "
|
||||
"add-*, notes/tags/fields, 2fa-*, profile-*, setting-*, relay-*, "
|
||||
"npub, nostr-reset-sync-state, nostr-fresh-namespace, sync-now/sync-bg, "
|
||||
"checksum-*, db-*, totp-export, parent-seed-backup, managed-load/exit, "
|
||||
"reveal/qr, page-*, retry, jump."
|
||||
)
|
||||
|
||||
def _palette_reference_text(self) -> str:
|
||||
return "\n".join(
|
||||
[
|
||||
"Palette Reference",
|
||||
"-----------------",
|
||||
"",
|
||||
"Core: help | help-commands | open <id> | jump <id> | search <q>",
|
||||
"Filters: filter <kind|all> | archive-filter <active|all|archived>",
|
||||
"Pages: page-next | page-prev | page <n>",
|
||||
"",
|
||||
"Entry Actions: archive | restore | reveal [confirm] | qr [public|private] [confirm]",
|
||||
"Docs: edit-doc | save-doc | cancel-edit | doc-export [output_path]",
|
||||
"Graph: link-add <target> [relation] [note] | link-rm <target> [relation]",
|
||||
"Graph Nav: link-filter <relation|all> | link-next | link-prev | link-open",
|
||||
"",
|
||||
"Add: add-password | add-totp | add-key-value | add-document | add-ssh | add-pgp | add-nostr | add-seed | add-managed-account",
|
||||
"Entry Fields: notes-set | notes-clear | tag-add | tag-rm | tags-set | tags-clear | field-add | field-rm | set-field | clear-field",
|
||||
"",
|
||||
"2FA: 2fa-board | 2fa-hide | 2fa-refresh | 2fa-copy <entry_id>",
|
||||
"Profiles: profiles-list | profile-switch | profile-add | profile-remove | profile-rename",
|
||||
"Settings: setting-secret | setting-offline | setting-quick-unlock | setting-timeout | setting-kdf-iterations | setting-kdf-mode",
|
||||
"Nostr: relay-list | relay-add | relay-rm | relay-reset | npub | nostr-reset-sync-state | nostr-fresh-namespace",
|
||||
"Sync/Utility: sync-now | sync-bg | checksum-verify | checksum-update | db-export | db-import | totp-export | parent-seed-backup",
|
||||
"Sessions: managed-load [entry_id] | managed-exit",
|
||||
"",
|
||||
"Tip: use '?' for compact keyboard help overlay.",
|
||||
]
|
||||
)
|
||||
|
||||
def _update_help_overlay(self) -> None:
|
||||
box = self.query_one("#help-overlay", Static)
|
||||
if not self.help_open:
|
||||
@@ -1391,26 +1432,19 @@ def launch_tui2(
|
||||
return
|
||||
|
||||
if cmd == "help":
|
||||
self._set_status(
|
||||
"Palette commands: help, open, search, filter, archive, "
|
||||
"restore, archive-filter, edit-doc, save-doc, cancel-edit, link-add, link-rm, "
|
||||
"add-password, add-totp, add-key-value, add-document, add-ssh, "
|
||||
"add-pgp, add-nostr, add-seed, add-managed-account, "
|
||||
"notes-set, notes-clear, tag-add, tag-rm, tags-set, tags-clear, "
|
||||
"field-add, field-rm, set-field, clear-field, doc-export, "
|
||||
"2fa-board, 2fa-hide, 2fa-refresh, 2fa-copy, "
|
||||
"profiles-list, profile-switch, profile-add, profile-remove, profile-rename, "
|
||||
"setting-secret, setting-offline, setting-quick-unlock, setting-timeout, "
|
||||
"setting-kdf-iterations, setting-kdf-mode, "
|
||||
"relay-list, relay-add, relay-rm, relay-reset, "
|
||||
"npub, nostr-reset-sync-state, nostr-fresh-namespace, "
|
||||
"sync-now, sync-bg, "
|
||||
"checksum-verify, checksum-update, db-export, db-import, "
|
||||
"totp-export, parent-seed-backup, managed-load, managed-exit, "
|
||||
"reveal [confirm], qr [public|private] [confirm], link-filter, "
|
||||
"link-next, link-prev, link-open, page-next, page-prev, page <n>, "
|
||||
"retry, jump <id>"
|
||||
self.query_one("#entry-detail", Static).update(
|
||||
self._palette_reference_text()
|
||||
)
|
||||
self._set_status(self._palette_help_summary())
|
||||
return
|
||||
if cmd in {"help-commands", "commands"}:
|
||||
if args:
|
||||
self._set_status("Usage: help-commands")
|
||||
return
|
||||
self.query_one("#entry-detail", Static).update(
|
||||
self._palette_reference_text()
|
||||
)
|
||||
self._set_status("Displayed full palette command reference")
|
||||
return
|
||||
if cmd == "retry":
|
||||
self.action_retry_last_error()
|
||||
|
||||
@@ -504,6 +504,7 @@ async def test_tui2_matrix_actions_palette_events_and_guards() -> None:
|
||||
app._run_palette_command("page")
|
||||
app._run_palette_command("page abc")
|
||||
app._run_palette_command("page 0")
|
||||
app._run_palette_command("help-commands now")
|
||||
app._run_palette_command("link-filter")
|
||||
app._run_palette_command("link-add")
|
||||
app._run_palette_command("link-add no")
|
||||
@@ -577,6 +578,7 @@ async def test_tui2_matrix_actions_palette_events_and_guards() -> None:
|
||||
await pilot.pause()
|
||||
|
||||
app._run_palette_command("help")
|
||||
app._run_palette_command("help-commands")
|
||||
app._run_palette_command("search Doc")
|
||||
app._run_palette_command("filter document")
|
||||
app._run_palette_command("archive-filter all")
|
||||
|
||||
@@ -738,6 +738,26 @@ async def test_tui2_textual_link_commands_and_neighbor_open() -> None:
|
||||
assert "No graph links" in links_text
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_tui2_textual_palette_help_commands_reference() -> None:
|
||||
service = FakeEntryService([{"id": 1, "kind": "document", "label": "Doc 1"}])
|
||||
app = _build_app(service)
|
||||
|
||||
async with app.run_test() as pilot:
|
||||
await pilot.pause()
|
||||
|
||||
await _run_palette(app, pilot, "help-commands")
|
||||
detail = _widget_text(app, "#entry-detail")
|
||||
assert "Palette Reference" in detail
|
||||
assert "archive-filter <active|all|archived>" in detail
|
||||
assert "npub" in detail
|
||||
assert "Displayed full palette command reference" in _status_text(app)
|
||||
|
||||
await _run_palette(app, pilot, "help")
|
||||
assert "Palette Reference" in _widget_text(app, "#entry-detail")
|
||||
assert "Palette commands:" in _status_text(app)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_tui2_textual_reveal_and_qr_flow() -> None:
|
||||
service = FakeEntryService(
|
||||
|
||||
Reference in new issue
Block a user