From 2834bd6964f6170df8f2ac0fe46334701d75fafb Mon Sep 17 00:00:00 2001 From: Hardik Zinzuvadiya <25708027+Z4nzu@users.noreply.github.com> Date: Sun, 15 Mar 2026 16:46:39 +0530 Subject: [PATCH] Restore Description column and 1-based numbering in collection menus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HackingToolsCollection.show_options(): - Add Description column back (was dropped during restructure) - Show first line of description; '—' for tools with no description - Switch to box.SIMPLE_HEAD with show_lines=True for row separators - Numbering changed from 0-based to 1-based (index 1..N) - Input validation updated: 1 <= choice <= len(active) with active[choice-1] --- core.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core.py b/core.py index fe93b9a..9485ae3 100644 --- a/core.py +++ b/core.py @@ -260,19 +260,23 @@ class HackingToolsCollection: incompatible = self._incompatible_tools() archived = self._archived_tools() - table = Table(title="Available Tools", box=box.MINIMAL_DOUBLE_HEAD) - table.add_column("No.", justify="center", style="bold cyan") - table.add_column("Tool", style="bold yellow") + table = Table(title="Available Tools", box=box.SIMPLE_HEAD, show_lines=True) + table.add_column("No.", justify="center", style="bold cyan", width=6) + table.add_column("Tool", style="bold yellow", min_width=24) + table.add_column("Description", style="white", overflow="fold") - for index, tool in enumerate(active): - table.add_row(str(index), tool.TITLE) + for index, tool in enumerate(active, start=1): + desc = getattr(tool, "DESCRIPTION", "") or "—" + # Show only first line of description to keep rows compact + desc = desc.splitlines()[0] if desc != "—" else "—" + table.add_row(str(index), tool.TITLE, desc) if archived: - table.add_row("[dim]98[/dim]", f"[archived]Archived tools ({len(archived)})[/archived]") + table.add_row("[dim]98[/dim]", f"[archived]Archived tools ({len(archived)})[/archived]", "") if incompatible: console.print(f"[dim]({len(incompatible)} tools hidden — not supported on current OS)[/dim]") - table.add_row("99", f"Back to {parent.TITLE if parent else 'Main Menu'}") + table.add_row("99", f"Back to {parent.TITLE if parent else 'Main Menu'}", "") console.print(table) raw = Prompt.ask("\n[bold cyan][?] Choose a tool[/bold cyan]", default="") @@ -288,9 +292,9 @@ class HackingToolsCollection: return elif choice == 98 and archived: self._show_archived_tools() - elif 0 <= choice < len(active): + elif 1 <= choice <= len(active): try: - ret = active[choice].show_options(parent=self) + active[choice - 1].show_options(parent=self) except Exception: console.print_exception(show_locals=True) Prompt.ask("[dim]Press Enter to continue[/dim]", default="")