updated git and svn scripts
[xrzperl.git] / git-config-user
blobbcec7896e2a3d18386ea1474a2d446e77984ea5e
1 #!/usr/bin/perl -w
2 # $Id$
3 use strict;
4 require v5.10.0;
5 our $VERSION = 'v0.1';
7 BEGIN
9 my $PROGRAM_DIR = $0;
10 $PROGRAM_DIR =~ s/[^\/\\]+$//;
11 $PROGRAM_DIR = "./" unless($PROGRAM_DIR);
12 unshift @INC,
13 map "$PROGRAM_DIR$_",qw{modules lib ../modules ..lib};
16 my %OPTS;
17 my @OPTIONS = qw/help|h|? version|ver edit-me manual|man/;
19 if(@ARGV)
21 require Getopt::Long;
22 require MyPlace::Usage;
23 Getopt::Long::GetOptions(\%OPTS,@OPTIONS);
24 MyPlace::Usage::Process(\%OPTS,$VERSION);
27 sub run {
28 print STDERR join(" ",@_),"\n";
29 return system(@_) == 0;
32 sub mm {
33 return "$_[0]\@gmail.com";
36 my $u = shift;
37 die("Usage: $0 <username>\n") unless($u);
38 if("eotect" =~ m/^$u/) {
39 run(qw/git config user.name/,"Nahn Eotect");
40 run(qw/git config user.email/,mm('eotect'));
42 elsif("xiaoranzzz" =~ m/^$u/) {
43 run(qw/git config user.name xiaoranzzz/);
44 run(qw/git config user.email/,mm("xiaoranzzz"));
46 elsif("nahncm" =~ m/^$u/) {
47 run(qw/git config user.name/,"Coding Machine");
48 run(qw/git config user.email/,mm("nahncm"));
50 else {
51 print STDERR "Can't not found user\n";
55 __END__
57 =pod
59 =head1 NAME
61 git-config-user - PERL script
63 =head1 SYNOPSIS
65 git-config-user [options] ...
67 =head1 OPTIONS
69 =over 12
71 =item B<--version>
73 Print version infomation.
75 =item B<-h>,B<--help>
77 Print a brief help message and exits.
79 =item B<--manual>,B<--man>
81 View application manual
83 =item B<--edit-me>
85 Invoke 'editor' against the source
87 =back
89 =head1 DESCRIPTION
91 ___DESC___
93 =head1 CHANGELOG
95 2010-10-31 xiaoranzzz <xiaoranzzz@myplace.hell>
97 * file created.
99 =head1 AUTHOR
101 xiaoranzzz <xiaoranzzz@myplace.hell>
103 =cut
105 # vim:filetype=perl