summaryrefslogtreecommitdiffstats
path: root/.config/fish/functions/gcr.fish
blob: 96d2087e88f68f0d256abb04de453e751dd661be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function gcr --description "clone a repository and file under username"
    if test (count $argv) -ne 1
        echo "git-clone-repository usage: gcr <repository url to clone>"
        return 1
    end

    set url $argv[1]
    set -l username (basename (dirname $url))
    set -l repository (basename $url)

    mkdir -p "$username"
    git clone "$url" "$username/$repository"
end