aboutsummaryrefslogtreecommitdiffstats
path: root/src/gitjoe-chowner.pl
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-07 21:58:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-07 21:58:35 +0200
commit4d484b3903b03828a275a49c9f35fc8d143feb84 (patch)
tree64df184d0510e2e0ea237745e78a2ad87718e4da /src/gitjoe-chowner.pl
parentRename (diff)
downloadjoe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.gz
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.bz2
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.xz
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.tar.zst
joe-scripts-4d484b3903b03828a275a49c9f35fc8d143feb84.zip
New script for changing owners
Diffstat (limited to 'src/gitjoe-chowner.pl')
-rwxr-xr-xsrc/gitjoe-chowner.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gitjoe-chowner.pl b/src/gitjoe-chowner.pl
new file mode 100755
index 0000000..6d2a5a2
--- /dev/null
+++ b/src/gitjoe-chowner.pl
@@ -0,0 +1,32 @@
+#!/usr/local/bin/perl
+
+use strict;
+use warnings;
+use Term::ANSIColor;
+
+sub main {
+ my $argc = $#ARGV + 1;
+ if ($argc < 3) {
+ print colored("Failed!\n", 'bold red')
+ . "Missing argument, 3 needed "
+ . colored("[user - reponame - new owner]", 'bold')
+ . "\n";
+ exit 1;
+ }
+ my $usr = $ARGV[0];
+ my $repo = $ARGV[1];
+ my $owner = $ARGV[2];
+ my $home_dir = '/usr/home/' . $usr . '/';
+ if (substr($repo, -4) ne '.git') {
+ $repo = $repo . '.git';
+ }
+ $repo = $repo . '/';
+ open(my $owner_fh, '>:encoding(utf-8)', $home_dir . $repo . 'owner');
+ print $owner_fh $owner;
+ close($owner_fh);
+ exit;
+}
+
+main();
+
+__END__