config(fish): add fish completions for cli tools

This commit is contained in:
Prad Nukala committed 2026-07-16 16:58:06 -04:00
1 parent b1fb6ee6fb
commit 7db95c2076
48 files changed
+2241

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
function ghg -a repo
# ghq natively understands https://, ssh://, git@host:…, and host/user/repo
ghq get $repo; or return
# Reduce the input to ghq's on-disk shape: <host>/<user>/<repo>
set -l rel (string replace -r '^\w+://' '' -- $repo) # strip scheme (https://, ssh://, git://)
set rel (string replace -r '^[^@/]+@' '' -- $rel) # strip user@ (git@github.com:…)
set rel (string replace ':' '/' -- $rel) # scp host:path → host/path
set rel (string replace -r '\.git$' '' -- $rel) # strip trailing .git
# bare "user/repo" with no host → default to github.com
string match -q '*.*/*' -- $rel; or set rel github.com/$rel
set -l dir (ghq root)/$rel
cd $dir; or return
zoxide add $dir
clear; and onefetch
end