X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Futil%2FCommandLineArguments.java;h=f75eb691d5d78a8c1f73d03888f45642a5175104;hb=9c3a223ef0fd72affdb9f4e40845d1e3ebe52f90;hp=7e2a167710c619ccbb96e20e9c73b79232f0156f;hpb=656be28debec520e0e35a8b311114398a40ea366;p=jalview.git diff --git a/forester/java/src/org/forester/util/CommandLineArguments.java b/forester/java/src/org/forester/util/CommandLineArguments.java index 7e2a167..f75eb69 100644 --- a/forester/java/src/org/forester/util/CommandLineArguments.java +++ b/forester/java/src/org/forester/util/CommandLineArguments.java @@ -93,7 +93,7 @@ public final class CommandLineArguments { if ( o.containsKey( option_name ) ) { final String value = o.get( option_name ); if ( !ForesterUtil.isEmpty( value ) ) { - return value; + return value.replaceAll( "\\s+", " " ).trim(); } else { throw new IllegalArgumentException( "value for \"" + option_name + "\" is not set" ); @@ -106,12 +106,16 @@ public final class CommandLineArguments { /** * Removes quotes - * + * */ public String getOptionValueAsCleanString( final String option_name ) throws IllegalArgumentException { return getOptionValue( option_name ).replaceAll( "\"", "" ).replaceAll( "\'", "" ); } + public char getOptionValueAsChar( final String option_name ) throws IllegalArgumentException { + return getOptionValue( option_name ).charAt( 0 ); + } + public double getOptionValueAsDouble( final String option_name ) throws IOException { double d = -Double.MAX_VALUE; try { @@ -220,7 +224,7 @@ public final class CommandLineArguments { // } if ( getAllOptions().containsKey( key ) ) { throw new IllegalArgumentException( "attempt to set option \"" + key + "\" mutiple times [" + option - + "]" ); + + "]" ); } options_map.put( key, value ); }