mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
config(fish): add fish completions for cli tools
This commit is contained in:
1 parent
b1fb6ee6fb
commit
7db95c2076
48 files changed
+2241
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user