|
@@ -12,23 +12,18 @@ our @EXPORT_OK = qw(readConfig getStatus returnState addFiles commitChanges push
|
|
# and then required the logger object arg for all who don't fit that usecase
|
|
# and then required the logger object arg for all who don't fit that usecase
|
|
# TODO: Add info/debug logging for all subroutines
|
|
# TODO: Add info/debug logging for all subroutines
|
|
|
|
|
|
-sub checkPath {
|
|
|
|
|
|
+sub checkPath($$) {
|
|
|
|
|
|
my $path = shift;
|
|
my $path = shift;
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
if ( ! -d $path ) {
|
|
if ( ! -d $path ) {
|
|
- if ( defined $logger && $logger ne "" ) {
|
|
|
|
- $logger->error("$path doesn't look like a dir, exiting...");
|
|
|
|
- exit 1;
|
|
|
|
- } else {
|
|
|
|
- print "Failed and no logger passed, exiting...\n";
|
|
|
|
- exit 1;
|
|
|
|
- }
|
|
|
|
|
|
+ $logger->error("$path doesn't look like a dir, exiting...");
|
|
|
|
+ exit 1;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub returnConfigPath {
|
|
|
|
|
|
+sub returnConfigPath($$) {
|
|
|
|
|
|
my $path = shift;
|
|
my $path = shift;
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
@@ -40,7 +35,7 @@ sub returnConfigPath {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-sub readConfig {
|
|
|
|
|
|
+sub readConfig($$) {
|
|
|
|
|
|
# This sub is probably not really needed for what I'm trying to do
|
|
# This sub is probably not really needed for what I'm trying to do
|
|
# git itself already parses this config...but an interesting exercise non the less
|
|
# git itself already parses this config...but an interesting exercise non the less
|
|
@@ -98,7 +93,7 @@ sub readConfig {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub getStatus {
|
|
|
|
|
|
+sub getStatus($) {
|
|
|
|
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
my $gitCmd = findBin("git",$logger);
|
|
my $gitCmd = findBin("git",$logger);
|
|
@@ -108,7 +103,7 @@ sub getStatus {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub returnState {
|
|
|
|
|
|
+sub returnState($) {
|
|
|
|
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
my $gitCmd = findBin("git",$logger);
|
|
my $gitCmd = findBin("git",$logger);
|
|
@@ -148,7 +143,7 @@ sub returnState {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub addFiles {
|
|
|
|
|
|
+sub addFiles($$) {
|
|
|
|
|
|
my $filesToAddRef = shift;
|
|
my $filesToAddRef = shift;
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
@@ -161,7 +156,7 @@ sub addFiles {
|
|
|
|
|
|
# TODO: Possibly worth returning output for commitChanges(), pushChanges(), stashAndReset, even if I'm not using it right now
|
|
# TODO: Possibly worth returning output for commitChanges(), pushChanges(), stashAndReset, even if I'm not using it right now
|
|
|
|
|
|
-sub commitChanges {
|
|
|
|
|
|
+sub commitChanges($$) {
|
|
|
|
|
|
my $commitMsg = shift;
|
|
my $commitMsg = shift;
|
|
chomp $commitMsg;
|
|
chomp $commitMsg;
|
|
@@ -171,7 +166,7 @@ sub commitChanges {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub pushChanges {
|
|
|
|
|
|
+sub pushChanges($) {
|
|
|
|
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
my $gitCmd = findBin("git",$logger);
|
|
my $gitCmd = findBin("git",$logger);
|
|
@@ -196,7 +191,7 @@ sub dropStash($) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub stashAndReset {
|
|
|
|
|
|
+sub stashAndReset($) {
|
|
|
|
|
|
my $logger = shift;
|
|
my $logger = shift;
|
|
my $gitCmd = findBin("git",$logger);
|
|
my $gitCmd = findBin("git",$logger);
|
|
@@ -226,7 +221,7 @@ sub resetFromUpstream($) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-sub updateGitIgnore {
|
|
|
|
|
|
+sub updateGitIgnore($$$) {
|
|
|
|
|
|
my $path = shift;
|
|
my $path = shift;
|
|
# Maybe better to accept an array of values
|
|
# Maybe better to accept an array of values
|