Skip to content

Commit

Permalink
update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cwensel committed Jun 3, 2011
1 parent cc09b7e commit 828a43b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/java/multitool/Main.java
Expand Up @@ -108,7 +108,6 @@ public class Main

public static void main( String[] args )
{

Map<String, String> options = new LinkedHashMap<String, String>();
List<String[]> params = new LinkedList<String[]>();

Expand Down Expand Up @@ -154,7 +153,11 @@ private static void printUsage()
System.out.println( "" );
System.out.println( "Usage:" );

System.out.println( "options:" );
System.out.println( String.format( " %-25s %s", "dot", "write a plan DOT file to the given path then exit" ) );
System.out.println( "taps:" );
printFactoryUsage( TAP_FACTORIES );
System.out.println( "operations:" );
printFactoryUsage( PIPE_FACTORIES );

System.exit( 1 );
Expand Down Expand Up @@ -228,10 +231,10 @@ private static void printFactoryUsage( Factory[] factories )
{
for( Factory factory : factories )
{
System.out.println( String.format( " %-10s %s", factory.getAlias(), factory.getUsage() ) );
System.out.println( String.format( " %-25s %s", factory.getAlias(), factory.getUsage() ) );

for( String[] strings : factory.getParametersAndUsage() )
System.out.println( String.format( " %-10s %s", strings[ 0 ], strings[ 1 ] ) );
System.out.println( String.format( " %-25s %s", strings[ 0 ], strings[ 1 ] ) );
}
}

Expand Down Expand Up @@ -313,22 +316,29 @@ public void execute()
Flow flow = plan( getDefaultProperties() );

if( options.containsKey( "-dot" ) )
{
flow.writeDOT( options.get( "-dot" ) );
System.out.println( "wrote DOT file to: " + options.get( "-dot" ) );
System.out.println( "exiting" );
return;
}

flow.complete();
}
catch( PlannerException exception )
{
if( options.containsKey( "-dot" ) )
{
exception.writeDOT( options.get( "-dot" ) );
System.out.println( "wrote DOT file to: " + options.get( "-dot" ) );
}

throw exception;
}
}

public Flow plan( Properties properties )
{

Map<String, Pipe> pipes = new HashMap<String, Pipe>();
Map<String, Tap> sources = new HashMap<String, Tap>();
Map<String, Tap> sinks = new HashMap<String, Tap>();
Expand Down

0 comments on commit 828a43b

Please sign in to comment.