mirror of https://github.com/nirenjan/dotfiles.git
				
				
				
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			654 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			28 lines
		
	
	
		
			654 B
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
| #!/usr/bin/env perl
 | |
| # Script to apply git configuration to global gitconfig
 | |
| 
 | |
| my $section = 'unknown';
 | |
| my $variable;
 | |
| my $value;
 | |
| my $command;
 | |
| 
 | |
| while(<>) {
 | |
|     chomp;
 | |
|     if (m/^\[(\w+)\]$/) {
 | |
|         $section = $1;
 | |
|         #print "Section: $section\n";
 | |
|     } elsif (m/^\[(\w+) +"(\w+)"\]/) {
 | |
|         $section = "$1.$2";
 | |
|         #print "Section: $section\n";
 | |
|     } elsif (m/(\w+) += +(.+)$/) {
 | |
|         $variable = $1;
 | |
|         $value = $2;
 | |
| 
 | |
|         $value =~ s/"/\\"/g;
 | |
|         #print "\t$section.$variable = \"$value\"\n";
 | |
|         $command = "git config --global $section.$variable \"$value\"";
 | |
|         print "$command\n";
 | |
|         system($command);
 | |
|     }
 | |
| }
 |