defect 2988469: display help or version info when -h or -v is specified

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5983 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2010-05-06 08:47:19 +00:00
parent 5a7cda2aaf
commit b234aa6f9c

View File

@ -29,6 +29,26 @@ if (-p STDIN) {
$cmdref->{stdin}->[0]=$data;
}
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");
GetOptions('h|help' => \$::HELP,
'v|version' => \$::VERSION);
# display the usage if -h or --help is specified
if ($::HELP)
{
&updatenode_usage($callback);
exit 0;
}
# display the version statement if -v or --verison is specified
if ($::VERSION)
{
my $version = xCAT::Utils->Version();
print "$version\n";
exit 0;
}
my $arg=shift(@ARGV);
# Set the noderange
@ -58,9 +78,6 @@ push (@{$cmdref->{arg}}, @ARGV);
# if trying to update security, get the password
# to access the target node firstly
Getopt::Long::Configure("posix_default");
Getopt::Long::Configure("no_gnu_compat");
Getopt::Long::Configure("bundling");
if (
!GetOptions(
'c|cmdlineonly' => \$::CMDLINE,