feat(functions): add open-url and repo-open browser helpers
Extract the browser-detection and launch logic out of config-help into a reusable open-url function, then build repo-open on top of it to open the current repo's origin remote in a browser. - open-url: resolve the best graphical browser (fish_help_browser -> BROWSER -> xdg-mime https handler -> known binaries -> xdg-open) and launch it backgrounded. Silent by default; -v/--verbose reports the browser, -s/--silent is accepted explicitly. Browser console chatter is discarded. - repo-open: normalize the origin URL from HTTPS and SSH/scp forms, deep-link to the current branch (falling back to the remote default) and sub-directory. Provider layout resolved via git config browse.provider, hostname heuristic (github/gitlab/gitea/bitbucket, codeberg->gitea), then github default. -p/--print emits the URL, -r/--root ignores the sub-directory. - config-help: replace the inlined browser block with an open-url call. - abbr: add open-repo and url-open abbreviations that expand to the canonical command names on space/enter. - docs: document both functions in the SSoT (fish-config.md + index) and add a repo-open row to the README doc-browsing table.
This commit is contained in:
@@ -313,6 +313,12 @@ abbr -a ssct 'sudo systemctl status'
|
||||
abbr -a sscs 'sudo systemctl start'
|
||||
abbr -a sscr 'sudo systemctl restart'
|
||||
|
||||
### Alternate command names ###
|
||||
# Expand to the canonical function name so muscle-memory typos still work,
|
||||
# while surfacing the real command instead of silently forwarding to it.
|
||||
abbr -a open-repo repo-open
|
||||
abbr -a url-open open-url
|
||||
|
||||
### History Expansions and Substitutions ###
|
||||
# Bash-style history expansion is opinionated (C3 overrides), gated atomically
|
||||
# with conf.d/tricks.fish, conf.d/puffer.fish, and functions/expand_*.fish.
|
||||
|
||||
Reference in New Issue
Block a user