feat(functions): add open-url and repo-open browser helpers #67
Reference in New Issue
Block a user
Delete Branch "feat-open-url-and-repo-open"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Why: The browser-launching logic (best-browser detection + backgrounded launch) was buried inside
config-help --htmland not reusable. This extracts it and builds a repo-browsing convenience on top.What:
open-url— new function. Resolves the best graphical browser ($fish_help_browser→$BROWSER→xdg-mimehttps handler → known binaries →xdg-open) and launches it backgrounded. Silent by default (-v/--verbosereports the browser,-s/--silentaccepted explicitly). Browser console chatter (e.g. "Opening in existing browser session.") is discarded.repo-open— new function. Opens the current repo'soriginremote in a browser viaopen-url. Normalizes HTTPS and SSH/scp remote forms, deep-links to the current branch (falling back to the remote default) and sub-directory. Provider layout resolved viagit config browse.provider→ hostname heuristic (github/gitlab/gitea/bitbucket, codeberg→gitea) → github default.-p/--printemits the URL;-r/--rootignores the sub-directory.config-help— the inlined browser block (~65 lines) now just callsopen-url.open-repoandurl-openexpand to the canonical command names on space/enter (visible hint, not a silent alias).fish-config.md+.index); README doc-browsing table gains arepo-openrow.Manual Verification
repo-open --printprintshttps://git.rootiest.dev/rootiest/fish-configfrom the repo root.cd docs; repo-open --printprints…/src/branch/main/docs(gitea layout, current sub-directory).repo-open(no flags) opens the repo web page in your browser with no terminal output.open-url https://example.comopens the page silently;open-url -v https://example.comprints anOpening <browser>…line.help config --htmlstill opens the local HTML docs in the browser (config-help extraction intact).open-repothen press space — it expands torepo-open; same forurl-open→open-url.