|
From: Jeff S. <jsq...@us...> - 2004-01-15 17:08:49
|
Update of /cvsroot/env-switcher/env-switcher/src
In directory sc8-pr-cvs1:/tmp/cvs-serv27407/src
Modified Files:
switcher.in
Log Message:
- Have two different help messages (normal and "more help")
- Document the "=" operator (was conspicuously absent from the help message)
- Get the default value for the "announce" attribute from configure
Index: switcher.in
===================================================================
RCS file: /cvsroot/env-switcher/env-switcher/src/switcher.in,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** switcher.in 29 Oct 2002 16:21:20 -0000 1.13
--- switcher.in 15 Jan 2004 17:08:40 -0000 1.14
***************
*** 1,6 ****
#!/usr/bin/perl -- -*- perl -*-
#
! # Copyright (c) 2002 The Trustees of Indiana University.
! # All rights reserved.
#
# This file is part of the Env-switcher software package. For license
--- 1,6 ----
#!/usr/bin/perl -- -*- perl -*-
#
! # Copyright (c) 2002-2004 The Trustees of Indiana University.
! # All rights reserved.
#
# This file is part of the Env-switcher software package. For license
***************
*** 30,33 ****
--- 30,35 ----
my $deleted_value = " _-=DELETED=-_ ";
+ my $default_announce_value = "@DEFAULT_ANNOUNCE_VALUE@";
+
# Create new AppConfig objects for the system and user files
***************
*** 54,62 ****
my $action_done = 0;
- my $want_help = 0;
my $return_value = 0;
my $user_file_modified = 0;
my $system_file_modified = 0;
my $switcher_silent = 0;
my $announce_load = 0;
my $announce_warn = 0;
--- 56,65 ----
my $action_done = 0;
my $return_value = 0;
my $user_file_modified = 0;
my $system_file_modified = 0;
my $switcher_silent = 0;
+ my $switcher_help = 0;
+ my $switcher_more_help = 0;
my $announce_load = 0;
my $announce_warn = 0;
***************
*** 134,143 ****
--force Do the action without prompting for confirmation
--silent Do not print any status/warning messages
! List all available tags
! \$ switcher --list
! List all available names for <tag>
! \$ switcher <tag> --list
Resolve and show all atrributes for <tag> for system scope, user
--- 137,182 ----
--force Do the action without prompting for confirmation
--silent Do not print any status/warning messages
+ (equivalent to setting \"announce\" tag to \"error\")
+
+ Most commonly used option:
+ \$ switcher <tag> = <name>
+
+ For example:
+ \$ switcher mpi = lam-7.0.2
+
+ To list all available <tag> and <name> values, use:
+
+ \$ switcher --list # List all available <tag> values
+ \$ switcher <tag> --list # List all available <name> values for <tag>
+
+ For more help, type \"switcher --more-help
+ ";
+ }
! ############################################################################
! #
! # display_more_help
! #
! # Show the more detailed help message.
! #
! ############################################################################
! sub display_more_help {
! print "switcher syntax:
!
! General options (applied to most major commands)
! --force Do the action without prompting for confirmation
! --silent Do not print any status/warning messages
!
! Set a tag equal to a name
! \$ switcher <tag> = <name>
!
! List all available tags
! \$ switcher --list
!
! List all available names for <tag>
! \$ switcher <tag> --list
!
!
Resolve and show all atrributes for <tag> for system scope, user
***************
*** 391,395 ****
if (!$a) {
! $a = "warn,error";
} elsif ($a =~ /all/i) {
$a = "warn,error,load";
--- 430,435 ----
if (!$a) {
! # $a = "warn,error";
! $a = $default_announce_value;
} elsif ($a =~ /all/i) {
$a = "warn,error,load";
***************
*** 1286,1289 ****
--- 1326,1332 ----
$clui_args->define("show!");
+ $clui_args->define("help!");
+ $clui_args->define("more-help!");
+
# Do the parsing. Since the parse routine will stop when it hits
# the first arg that doesn't begin with "-", we may have to parse
***************
*** 1308,1311 ****
--- 1351,1359 ----
$switcher_silent = $clui_args->silent();
+ $switcher_help = $clui_args->help();
+ $switcher_more_help = $clui_args->more_help();
+ if ($switcher_help || $switcher_more_help) {
+ $want_help = 1;
+ }
my $i = 0;
***************
*** 1337,1343 ****
elsif ($ARGV[$i] eq "add-name") {
if ($i + 2 > $#ARGV) {
! print_error("Error: must specify <name> and <dir> " .
! "arguments with --add-name\n");
! $want_help = 1;
} elsif (! -d $ARGV[$i + 2]) {
print_error("Error: <dir> argument must be a valid, " .
--- 1385,1393 ----
elsif ($ARGV[$i] eq "add-name") {
if ($i + 2 > $#ARGV) {
! if (!$switcher_silent) {
! print_error("Error: must specify <name> and <dir> " .
! "arguments with --add-name\n");
! $want_help = 1;
! }
} elsif (! -d $ARGV[$i + 2]) {
print_error("Error: <dir> argument must be a valid, " .
***************
*** 1449,1453 ****
elsif ($want_help) {
! display_help();
}
--- 1499,1507 ----
elsif ($want_help) {
! if ($switcher_more_help) {
! display_more_help();
! } else {
! display_help();
! }
}
|