use of edu.umass.cs.gnsclient.console.commands.Connect in project GNS by MobilityFirst.
the class ConsoleModule method handlePrompt.
/**
* Handle a series of commands
*
*/
public void handlePrompt() {
quit = false;
// Try to connect to the GNS
try {
new Connect(this).parse("");
} catch (Exception e) {
printString("Couldn't connect to GNS...\n");
}
if (useGnsDefaults) {
useGnsDefaults();
}
while (!quit) {
Map<String, ConsoleCommand> hashCommands = getHashCommands();
try {
String commandLine;
if (silent) {
console.flushConsole();
commandLine = readLineBypassJLine();
} else {
commandLine = console.readLine(getPromptString());
}
if (commandLine == null) {
quit();
break;
}
if (commandLine.equals("")) {
continue;
}
handleCommandLine(commandLine, hashCommands);
} catch (UnknownCommandException e) {
printString(e.getMessage() + "\n");
} catch (Exception e) {
printString("Error during console command execution: " + e.getMessage() + "\n");
e.printStackTrace();
}
}
GNSClientConfig.getLogger().fine("Quitting");
}
Aggregations