From 394e9d798856b55ddf24f1ff9300eae6c1f50fc3 Mon Sep 17 00:00:00 2001 From: sakolish Date: Mon, 21 Apr 2008 13:12:54 +0000 Subject: [PATCH] Changed "-w" flag (write mac to database) to "-d" (display mac only) - write mac by default now git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1128 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/PPCmac.pm | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/PPCmac.pm b/perl-xCAT-2.0/xCAT/PPCmac.pm index c22022ff8..5b256773d 100644 --- a/perl-xCAT-2.0/xCAT/PPCmac.pm +++ b/perl-xCAT-2.0/xCAT/PPCmac.pm @@ -4,7 +4,6 @@ package xCAT::PPCmac; use strict; use Getopt::Long; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); -use xCAT::Usage; @@ -17,13 +16,24 @@ sub parse_args { my %opt = (); my $cmd = $request->{command}; my $args = $request->{arg}; + my @VERSION = qw( 2.0 ); ############################################# # Responds with usage statement ############################################# local *usage = sub { - my $usage_string=xCAT::Usage->getUsage($cmd); - return( [ $_[0], $usage_string]); + return( [ $_[0], + "getmacs -h|--help", + "getmacs -v|--version", + "getmacs [-V|--verbose] noderange [-c][-w][-S server -G gateway -C client]", + " -h writes usage information to standard output", + " -v displays command version", + " -c colon seperated output", + " -C IP of the partition", + " -G Gateway IP of the partition specified", + " -S Server IP to ping", + " -V verbose output", + " -w writes first adapter MAC to the xCAT database"]); }; ############################################# # Process command-line arguments @@ -41,10 +51,22 @@ sub parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt,qw(V|Verbose C=s G=s S=s c w))) { + if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s c w))) { return( usage() ); } #################################### + # Option -h for Help + #################################### + if ( exists( $opt{h} )) { + return( usage() ); + } + #################################### + # Option -v for version + #################################### + if ( exists( $opt{v} )) { + return( \@VERSION ); + } + #################################### # Check for "-" with no option #################################### if ( grep(/^-$/, @ARGV )) {