diff options
Diffstat (limited to '.config/fish')
-rw-r--r-- | .config/fish/functions/gcr.fish | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.config/fish/functions/gcr.fish b/.config/fish/functions/gcr.fish new file mode 100644 index 0000000..96d2087 --- /dev/null +++ b/.config/fish/functions/gcr.fish | |||
@@ -0,0 +1,13 @@ | |||
1 | function gcr --description "clone a repository and file under username" | ||
2 | if test (count $argv) -ne 1 | ||
3 | echo "git-clone-repository usage: gcr <repository url to clone>" | ||
4 | return 1 | ||
5 | end | ||
6 | |||
7 | set url $argv[1] | ||
8 | set -l username (basename (dirname $url)) | ||
9 | set -l repository (basename $url) | ||
10 | |||
11 | mkdir -p "$username" | ||
12 | git clone "$url" "$username/$repository" | ||
13 | end | ||