Methods Summary |
---|
public void | goInteractive(com.sun.cli.util.LineReader lineReader, CmdRunner cmdRunner)
p( ADVISORY );
while ( true )
{
final String line = readLine( lineReader );
if ( isQuitLine( line ) )
{
println( "Quitting..." );
break;
}
if ( line.length() == 0 )
continue;
processLine( line, cmdRunner );
}
|
private static java.lang.String | initUsage()
String usage = "*** Available commands ***\n\n";
final CmdStrings.CmdHelp [] allHelp = CmdStrings.getAllHelp();
for( int i = 0; i < allHelp.length; ++i )
{
usage = usage + allHelp[ i ] + "\n\n";
}
return( usage );
|
boolean | isQuitLine(java.lang.String line)
final boolean isQuit =
line == null ||
line.equalsIgnoreCase( "quit" ) ||
line.equalsIgnoreCase( "q" ) ||
line.equalsIgnoreCase( "exit" );
line.equalsIgnoreCase( "exit" );
return( isQuit );
|
static java.lang.String[] | lineToTokens(java.lang.String line)
final TokenizerImpl tk = new TokenizerImpl( line, "" + DELIM_CHARS,
ESCAPE_CHAR, ESCAPABLE_CHARS);
return( tk.getTokens( ) );
|
private static void | p(java.lang.Object o)
System.out.println( SmartStringifier.toString( o ) );
|
public void | print(java.lang.Object o)
System.out.print( o.toString() );
|
public void | printDebug(java.lang.Object o)
println( o );
|
public void | printError(java.lang.Object o)
System.err.println( o.toString() );
|
public void | println(java.lang.Object o)
System.out.println( o.toString() );
|
public void | processCmd(java.lang.String line, CmdRunner cmdRunner)
final String [] tokens = lineToTokens( line );
try
{
final String cmdName = tokens[ 0 ];
cmdRunner.execute( cmdName, tokens );
}
catch (Exception e )
{
}
|
public static int | processLine(java.lang.String line, CmdRunner cmdRunner)
int errorCode = 0;
final String [] tokens = lineToTokens( line );
try
{
final String cmdName = tokens[ 0 ];
cmdRunner.execute( cmdName, tokens );
}
catch (Exception e )
{
errorCode = -1;
}
return( errorCode );
|
public java.lang.String | readLine(com.sun.cli.util.LineReader lineReader)
String line = lineReader.readLine( "> ");
if ( line != null )
{
line = line.trim();
}
return( line );
|