diff options
author | Yigit Sever | 2023-07-25 21:31:41 +0300 |
---|---|---|
committer | Yigit Sever | 2023-07-25 21:31:41 +0300 |
commit | 8cd3d6457a498cc887a59956184f7b85ea3f904d (patch) | |
tree | c7450326a72638441c2f8217da9ce4079af6dabd | |
parent | 66f83674945fc02408b99ddf5f353c88d3839866 (diff) | |
download | dotfiles-8cd3d6457a498cc887a59956184f7b85ea3f904d.tar.gz dotfiles-8cd3d6457a498cc887a59956184f7b85ea3f904d.tar.bz2 dotfiles-8cd3d6457a498cc887a59956184f7b85ea3f904d.zip |
fish: add gcr
git clone repository, not a very good name but is used to clone example.com/foo/bar under ./foo/bar
-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 | ||