From 8cd3d6457a498cc887a59956184f7b85ea3f904d Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Tue, 25 Jul 2023 21:31:41 +0300 Subject: fish: add gcr git clone repository, not a very good name but is used to clone example.com/foo/bar under ./foo/bar --- .config/fish/functions/gcr.fish | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .config/fish/functions/gcr.fish (limited to '.config/fish/functions') 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 @@ +function gcr --description "clone a repository and file under username" + if test (count $argv) -ne 1 + echo "git-clone-repository usage: gcr " + 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 -- cgit v1.2.3-61-g4310