From 1091a0590262b98d82ad7d3dca528b0a7bfeca6b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 28 Oct 2005 19:45:08 +0000 Subject: [PATCH] Make prompts more friendly, listing choices where appropriate. --- src/makeBaseApp/makeBaseApp.pl | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/makeBaseApp/makeBaseApp.pl b/src/makeBaseApp/makeBaseApp.pl index 521c4b030..b0ff928d7 100755 --- a/src/makeBaseApp/makeBaseApp.pl +++ b/src/makeBaseApp/makeBaseApp.pl @@ -1,7 +1,7 @@ eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- if $running_under_some_shell; # makeBaseApp -# Authors: Ralph Lange and Marty Kraimer +# Authors: Ralph Lange, Marty Kraimer, Andrew Johnson and Janet Anderson # $Id$ use Cwd; @@ -200,13 +200,22 @@ sub get_commandline_opts { #no args if (!@ARGV){ if ($opt_t) { if ($opt_i) { - print "IOC names? (the created directories will have \"ioc\" prepended): "; + my @iocs = map {s/iocBoot\///; $_} glob 'iocBoot/ioc*'; + if (@iocs) { + print "The following IOCs already exist here:\n", + map {" $_\n"} @iocs; + } + print "Name the IOC(s) to be created.\n", + "Names given will have \"ioc\" prepended to them.\n", + "IOC names? "; } else { - print "Application names? (the created directories will have \"App\" appended): "; - } + print "Name the application(s) to be created.\n", + "Names given will have \"App\" appended to them.\n", + "Application names? "; + } $namelist = ; chomp($namelist); - @names = split " ", $namelist; + @names = split /[\s,]/, $namelist; } else { Cleanup(1); } @@ -241,7 +250,14 @@ sub get_commandline_opts { #no args if ($opt_p){ $appnameIn = $opt_p if ($opt_p); } else { - print "Application name? (default is IOC name): "; + my @apps = glob '*App'; + if (@apps) { + print "The following applications are available:\n", + map {s/App$//; " $_\n"} @apps; + } + print "What application should the IOC(s) boot?\n", + "The default uses the IOC's name, even if not listed above.\n", + "Application name? "; $appnameIn = ; chomp($appnameIn); }