Skip to content

Commit

Permalink
cleaned up help output
Browse files Browse the repository at this point in the history
  • Loading branch information
ceteri committed May 10, 2012
1 parent ddcebb8 commit 07c7e80
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/java/multitool/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public class Main
{
optionMap.put( "-h", new Option( "-h", false, null ) );
optionMap.put( "--help", new Option( "--help", false, null ) );
optionMap.put( "--text", new Option( "--text", false, null ) );
optionMap.put( "--dot", new Option( "--dot", true, null ) );

for( Factory factory : TAP_FACTORIES )
Expand Down Expand Up @@ -182,7 +181,6 @@ private static void printUsage( boolean is_error )

System.out.println( "\n options:" );
System.out.println( String.format( " %-25s %s", "-h|--help", "show this help text" ) );
System.out.println( String.format( " %-25s %s", "--text", "parse input as a text delimited file" ) );
System.out.println( String.format( " %-25s %s", "--dot=<file>", "filename to write a plan DOT file then exit" ) );
System.out.println( "\n taps:" );
printFactoryUsage( TAP_FACTORIES );
Expand Down Expand Up @@ -257,7 +255,12 @@ public Main( Map<String, String> options, List<String[]> params )

this.params = params;

if( this.params.size() > 0 )
if( ( this.params.size() == 0 ) || options.containsKey( "-h" ) || options.containsKey( "--help" ) )
{
printUsage( false );
return;
}
else if( this.params.size() > 0 )
validateParams();
else
throw new IllegalArgumentException( "error: no parameters" );
Expand All @@ -277,7 +280,7 @@ private void validateParams()
throw new IllegalArgumentException( "error: first command must be source: " + params.get( 0 )[ 0 ] );

if( !params.get( params.size() - 1 )[ 0 ].startsWith( "sink" ) )
throw new IllegalArgumentException( "error: last command must be sink: " + params.get( params.size() - 1 ) );
throw new IllegalArgumentException( "error: last command must be sink: " + params.get( params.size() - 1 )[ 0 ] );
}

private Properties getDefaultProperties()
Expand Down
7 changes: 4 additions & 3 deletions src/java/multitool/factory/SinkFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public String[] getParameters()

public String[] getParametersUsage()
{
return new String[]{"fields to sink", "set true of output should be overwritten",
return new String[]{"fields to sink",
"set true of output should be overwritten",
"compression: enable, disable, or default",
"the delimiter to use to separate values",
"write to a sequence file instead of text, delim and compress are ignored"};
"delimiter used to separate fields",
"write to a sequence file instead of text; delim and compress are ignored"};
}
}
2 changes: 1 addition & 1 deletion src/java/multitool/factory/SourceFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ public String[] getParametersUsage()
{
return new String[]{"name of this source, required if more than one",
"set true if the first line should be skipped",
"is a tuple sequence file with N fields, or the value 'true'"};
"read from a sequence file instead of text; specify N fields, or 'true'"};
}
}

0 comments on commit 07c7e80

Please sign in to comment.