dotfiles

My dotfiles, nothing really interesting to see ...
git clone https://git.onna.be/dotfiles.git
Log | Files | Refs | README

commit 8328307a342b0cca43d6ac31b37a0bc7c10669ad
parent 5d14957877daa3a551b809d99db1ad4f16f228dc
Author: Paco Esteban <paco@onna.be>
Date:   Mon, 25 Jun 2018 18:34:21 +0200

git clone wrapper

Diffstat:
bin/bin/gitclone | 33+++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+), 0 deletions(-)

diff --git a/bin/bin/gitclone b/bin/bin/gitclone @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +use v5.26; +use strict; +use warnings; +use File::Path 'make_path'; + +if (scalar @ARGV < 1) { + say "Usage: clona.pl <repo_url>"; + exit 1; +} + +my $src_path = "$ENV{HOME}/src"; +my ($sub_path, $repo_name); +my $repo = $ARGV[0]; + +if ($repo =~ m/git@(.*):(.*)\/(.*)\.git/) { + # git@server.tld:user/repo.git + $sub_path = "$1/$2"; + $repo_name = $3; +} elsif ($repo =~ m/https?:\/\/(.*)\/(.*)\.git/) { + # https://server.tld/user/repo.git + $sub_path = $1; + $repo_name = $2; +} else { + say "URL not recognized."; + exit 1; +} + +say "going to --> $src_path/$sub_path ..."; +my $created = make_path("$src_path/$sub_path", {error => \my $err}); + +`cd $src_path/$sub_path && git clone $repo`;