reorder cli commands navigations are now into a nav sub group
This commit is contained in:
@@ -16,14 +16,19 @@ def _handle(command, args):
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
@click.command("open")
|
||||
@click.group("nav")
|
||||
def nav_group():
|
||||
"""Navigate — open URLs, reload, go back/forward, focus tabs."""
|
||||
|
||||
|
||||
@nav_group.command("open")
|
||||
@click.argument("url")
|
||||
@click.option("--bg", is_flag=True, help="Open in background (no focus)")
|
||||
@click.option("--window", "window_name", default=None, help="Open in named window")
|
||||
@click.option("--group", "group_name", default=None, help="Open directly into a tab group (name or ID)")
|
||||
def cmd_open(url, bg, window_name, group_name):
|
||||
"""Open URL in a new tab."""
|
||||
result = _handle("navigate.open", {"url": url, "background": bg, "window": window_name, "group": group_name})
|
||||
_handle("navigate.open", {"url": url, "background": bg, "window": window_name, "group": group_name})
|
||||
suffix = ""
|
||||
if group_name:
|
||||
suffix = f" in group '{group_name}'"
|
||||
@@ -32,7 +37,7 @@ def cmd_open(url, bg, window_name, group_name):
|
||||
console.print(f"[green]Opened:[/green] {url}{suffix}")
|
||||
|
||||
|
||||
@click.command("reload")
|
||||
@nav_group.command("reload")
|
||||
@click.argument("tab_id", type=int, required=False)
|
||||
def cmd_reload(tab_id):
|
||||
"""Reload the active (or specified) tab."""
|
||||
@@ -40,7 +45,7 @@ def cmd_reload(tab_id):
|
||||
console.print("[green]Reloaded[/green]")
|
||||
|
||||
|
||||
@click.command("hard-reload")
|
||||
@nav_group.command("hard-reload")
|
||||
@click.argument("tab_id", type=int, required=False)
|
||||
def cmd_hard_reload(tab_id):
|
||||
"""Hard reload (bypass cache) the active (or specified) tab."""
|
||||
@@ -48,7 +53,7 @@ def cmd_hard_reload(tab_id):
|
||||
console.print("[green]Hard reloaded[/green]")
|
||||
|
||||
|
||||
@click.command("back")
|
||||
@nav_group.command("back")
|
||||
@click.argument("tab_id", type=int, required=False)
|
||||
def cmd_back(tab_id):
|
||||
"""Navigate back in the active (or specified) tab."""
|
||||
@@ -56,7 +61,7 @@ def cmd_back(tab_id):
|
||||
console.print("[green]Navigated back[/green]")
|
||||
|
||||
|
||||
@click.command("forward")
|
||||
@nav_group.command("forward")
|
||||
@click.argument("tab_id", type=int, required=False)
|
||||
def cmd_forward(tab_id):
|
||||
"""Navigate forward in the active (or specified) tab."""
|
||||
@@ -64,7 +69,7 @@ def cmd_forward(tab_id):
|
||||
console.print("[green]Navigated forward[/green]")
|
||||
|
||||
|
||||
@click.command("focus")
|
||||
@nav_group.command("focus")
|
||||
@click.argument("pattern")
|
||||
def cmd_focus(pattern):
|
||||
"""Jump to the first tab whose URL matches PATTERN."""
|
||||
|
||||
Reference in New Issue
Block a user