commit 20bd74fcfcb85e7e0db24f3e8a5322448861f321
Author: spesk1 <spesk@pm.me>
Date: Tue May 21 21:59:23 2019 -0400
Updated Git.pm with strict sub args
diff --git a/lib/SimplyGit/Git.pm b/lib/SimplyGit/Git.pm
index 2f8378b..e53c7da 100644
--- a/lib/SimplyGit/Git.pm
+++ b/lib/SimplyGit/Git.pm
@@ -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
# TODO: Add info/debug logging for all subroutines
-sub checkPath {
+sub checkPath($$) {
my $path = shift;
my $logger = shift;
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 $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
# 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 $gitCmd = findBin("git",$logger);
@@ -108,7 +103,7 @@ sub getStatus {
}
-sub returnState {
+sub returnState($) {
my $logger = shift;
my $gitCmd = findBin("git",$logger);
@@ -148,7 +143,7 @@ sub returnState {
}
-sub addFiles {
+sub addFiles($$) {
my $filesToAddRef = 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
-sub commitChanges {
+sub commitChanges($$) {
my $commitMsg = shift;
chomp $commitMsg;
@@ -171,7 +166,7 @@ sub commitChanges {
}
-sub pushChanges {
+sub pushChanges($) {
my $logger = shift;
my $gitCmd = findBin("git",$logger);
@@ -196,7 +191,7 @@ sub dropStash($) {
}
-sub stashAndReset {
+sub stashAndReset($) {
my $logger = shift;
my $gitCmd = findBin("git",$logger);
@@ -226,7 +221,7 @@ sub resetFromUpstream($) {
}
-sub updateGitIgnore {
+sub updateGitIgnore($$$) {
my $path = shift;
# Maybe better to accept an array of values
diff --git a/sg b/sg
index 1ec2459..2b9e424 100755
--- a/sg
+++ b/sg
@@ -185,7 +185,7 @@ if ( defined $args{'view'} ) {
chomp $name;
my $email = shellex("$gitCmd config --get user.email",$logger);
chomp $email;
- print "Username: $name Email: $email\n";
+ print "-->Username: $name\n-->Email: $email\n";
print "On [branch] @ commit: $branch";
print "$refs\n";
my $swpWarning = "\t# Likely a Vi .swp file";