mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
Adds --help|-h options; shows usage message and exits 0 if no arguments
This commit is contained in:
@@ -1475,6 +1475,11 @@ sub initStationAddr {
|
|||||||
## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||||
|
|
||||||
my $help;
|
my $help;
|
||||||
|
|
||||||
|
if (@ARGV < 2) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
GetOptions
|
GetOptions
|
||||||
(
|
(
|
||||||
'mgr|m=s' => \$::lfmgr_host,
|
'mgr|m=s' => \$::lfmgr_host,
|
||||||
|
|||||||
@@ -55,9 +55,15 @@ Example:
|
|||||||
$0 --mgr 192.168.100.138 --action set_atten --atten_serno 3 --atten_idx all --atten_val 550\n";
|
$0 --mgr 192.168.100.138 --action set_atten --atten_serno 3 --atten_idx all --atten_val 550\n";
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
|
my $show_help = 0;
|
||||||
|
|
||||||
|
if (@ARGV < 2) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
GetOptions
|
GetOptions
|
||||||
(
|
(
|
||||||
|
'help|h' => \$show_help,
|
||||||
'atten_serno|s=s' => \$atten_serno,
|
'atten_serno|s=s' => \$atten_serno,
|
||||||
'atten_idx|i=s' => \$atten_idx,
|
'atten_idx|i=s' => \$atten_idx,
|
||||||
'atten_val|v=s' => \$atten_val,
|
'atten_val|v=s' => \$atten_val,
|
||||||
@@ -70,6 +76,10 @@ GetOptions
|
|||||||
|
|
||||||
) || (print($usage) && exit(1));
|
) || (print($usage) && exit(1));
|
||||||
|
|
||||||
|
if ($show_help) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($do_cmd ne "NA") {
|
if ($do_cmd ne "NA") {
|
||||||
$action = "do_cmd";
|
$action = "do_cmd";
|
||||||
|
|||||||
@@ -150,11 +150,18 @@ Example:
|
|||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my $cmd;
|
my $cmd;
|
||||||
die($::usage) if (@ARGV < 2);
|
|
||||||
my $log_cli = "unset"; # use ENV{LOG_CLI} elsewhere
|
my $log_cli = "unset"; # use ENV{LOG_CLI} elsewhere
|
||||||
|
my $show_help = 0;
|
||||||
|
|
||||||
|
if (@ARGV < 2) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
GetOptions
|
GetOptions
|
||||||
(
|
(
|
||||||
|
'help|h' => \$show_help,
|
||||||
'endp_name|e=s' => \$::endp_name,
|
'endp_name|e=s' => \$::endp_name,
|
||||||
'endp_cmd=s' => \$::endp_cmd,
|
'endp_cmd=s' => \$::endp_cmd,
|
||||||
'endp_vals|o=s' => \$::endp_vals,
|
'endp_vals|o=s' => \$::endp_vals,
|
||||||
@@ -186,6 +193,11 @@ GetOptions
|
|||||||
'log_cli=s{0,1}'=> \$log_cli,
|
'log_cli=s{0,1}'=> \$log_cli,
|
||||||
) || die("$::usage");
|
) || die("$::usage");
|
||||||
|
|
||||||
|
if ($show_help) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($::quiet eq "0") {
|
if ($::quiet eq "0") {
|
||||||
$::quiet = "no";
|
$::quiet = "no";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ my $i = 0;
|
|||||||
|
|
||||||
GetOptions
|
GetOptions
|
||||||
(
|
(
|
||||||
|
'help|h' => \$show_help,
|
||||||
'endp_name|e=s' => \$endp_name,
|
'endp_name|e=s' => \$endp_name,
|
||||||
'speed|s=i' => \$speed,
|
'speed|s=i' => \$speed,
|
||||||
'cx|c=s' => \$cx,
|
'cx|c=s' => \$cx,
|
||||||
@@ -95,9 +96,13 @@ GetOptions
|
|||||||
'load|L=s' => \$load,
|
'load|L=s' => \$load,
|
||||||
'state|S=s' => \$state,
|
'state|S=s' => \$state,
|
||||||
'quiet|q=i' => \$quiet,
|
'quiet|q=i' => \$quiet,
|
||||||
|
|
||||||
) || die("$usage");
|
) || die("$usage");
|
||||||
|
|
||||||
|
if ($show_help) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (! ($quiet == 0xffff)) {
|
if (! ($quiet == 0xffff)) {
|
||||||
open(CMD_LOG, ">$cmd_log_name") or die("Can't open $cmd_log_name for writing...\n");
|
open(CMD_LOG, ">$cmd_log_name") or die("Can't open $cmd_log_name for writing...\n");
|
||||||
if (! ($quiet & 0x2)) {
|
if (! ($quiet & 0x2)) {
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ my $usage = "$0 --port_name {name | number}
|
|||||||
[--eap_identity {value|[BLANK]}]
|
[--eap_identity {value|[BLANK]}]
|
||||||
[--eap_passwd {value|[BLANK]}]
|
[--eap_passwd {value|[BLANK]}]
|
||||||
[--log_file {value}] # disabled by default
|
[--log_file {value}] # disabled by default
|
||||||
|
[--help|-h ] # show help
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
./lf_portmod.pl --manager 192.168.1.101 --card 1 --port_name eth2 --show_port
|
./lf_portmod.pl --manager 192.168.1.101 --card 1 --port_name eth2 --show_port
|
||||||
@@ -110,9 +111,15 @@ Examples:
|
|||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my $log_cli = 'unset';
|
my $log_cli = 'unset';
|
||||||
|
my $show_help = 0;
|
||||||
|
|
||||||
|
if (@ARGV < 2) {
|
||||||
|
print $usage;
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
GetOptions
|
GetOptions
|
||||||
(
|
(
|
||||||
|
'help|h' => \$show_help,
|
||||||
'ap=s' => \$ap,
|
'ap=s' => \$ap,
|
||||||
'port_name|e=s' => \$port_name,
|
'port_name|e=s' => \$port_name,
|
||||||
'cmd|c=s' => \$cmd,
|
'cmd|c=s' => \$cmd,
|
||||||
@@ -145,6 +152,11 @@ GetOptions
|
|||||||
$::quiet = "yes";
|
$::quiet = "yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($show_help) {
|
||||||
|
print $usage;
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
# Open connection to the LANforge server.
|
# Open connection to the LANforge server.
|
||||||
if (defined $log_cli) {
|
if (defined $log_cli) {
|
||||||
if ($log_cli ne "unset") {
|
if ($log_cli ne "unset") {
|
||||||
|
|||||||
Reference in New Issue
Block a user