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: // 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