| 
					
				 | 
			
			
				@@ -8,7 +8,7 @@ use Log::Log4perl qw(:easy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This needs to be scoped properly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use lib "/usr/local/lib"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use SimplyGit::Shellex qw(shellex findBin); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges stashAndReset resetFromUpstream updateGitIgnore); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges stashAndReset resetFromUpstream updateGitIgnore appendRepoUserConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This should maybe be more robust? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if ( ! -d ".git" ) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -67,6 +67,9 @@ GetOptions( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'branch-from-master', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'commit-msg=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'dump-config', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	'configure-local-user', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	'user=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	'email=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 sub printHelp { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -93,6 +96,10 @@ Usage: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	--branch-from-master 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Create a new clean branch from upstream/master 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	--configure-local-user [--user,--email] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Configure local git user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 EOF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,17 +144,43 @@ sub parseArgs { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ( defined $args{'configure-local-user'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ( scalar keys %args < 2 ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			print "Must pass either --interactive or --user AND --email to --configure-local-user\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			exit 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		foreach my $arg ( keys %args ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if ( $arg eq "interactive" || $arg eq "user" || $arg eq "email" || $arg eq "configure-local-user" ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				next; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				print "Must/can only pass --interactive, OR --user AND --email with --configure-local-user\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exit 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if ( ! defined $args{'interactive'} && ! defined $args{'user'} || ! defined $args{'interactive'} && ! defined $args{'email'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			print "If not using --interactive with --configure-local-user, --user and --email MUST be defined\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			exit 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 parseArgs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#print "Args parsed successfully\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#exit 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This sub could be more concise with a sub to print array refs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if ( defined $args{'view'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my ( $untrackedRef, $modifiedRef, $addedRef, $deletedRef ) = returnState($logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my $refs = shellex("$gitCmd show-ref",$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my $branch = shellex("$gitCmd show-branch",$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	my $name = shellex("$gitCmd config --get user.name",$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	chomp $name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	my $email = shellex("$gitCmd config --get user.email",$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	chomp $email; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	print "Username: $name\nEmail: $email\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	print "On [branch] @ commit: $branch"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	print "$refs\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my $swpWarning = "\t# Likely a Vi .swp file"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -295,3 +328,23 @@ if ( defined $args{'dump-config'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+if ( defined $args{'configure-local-user'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ( defined $args{'interactive'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Enter user to set: "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		my $desiredName = <STDIN>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		chomp $desiredName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Enter email to set: "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		my $desiredEmail = <STDIN>; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		chomp $desiredEmail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		appendRepoUserConfig($desiredName,$desiredEmail,$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		appendRepoUserConfig($args{'user'},$args{'email'},$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |