use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class GeogigCLI method main.
/**
* Entry point for the command line interface.
*
* @param args
*/
public static void main(String[] args) {
Logging.tryConfigureLogging();
ConsoleReader consoleReader;
try {
consoleReader = new ConsoleReader(System.in, System.out);
// needed for CTRL+C not to let the console broken
consoleReader.getTerminal().setEchoEnabled(true);
} catch (Exception e) {
throw Throwables.propagate(e);
}
final GeogigCLI cli = new GeogigCLI(consoleReader);
addShutdownHook(cli);
int exitCode = cli.execute(args);
try {
cli.close();
} finally {
try {
consoleReader.getTerminal().restore();
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
exitCode = -1;
}
consoleReader.shutdown();
}
if (exitCode != 0 || cli.isExitOnFinish()) {
System.exit(exitCode);
}
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class ShpImportTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
setUpGeogig(cli);
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class PGDescribeTest method testDescribeException.
@Test
public void testDescribeException() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
GeogigCLI mockCli = spy(new GeogigCLI(consoleReader));
setUpGeogig(mockCli);
when(mockCli.getConsole()).thenThrow(new MockitoException("Exception"));
PGDescribe describeCommand = new PGDescribe();
describeCommand.table = "table1";
describeCommand.dataStoreFactory = TestHelper.createTestFactory();
exception.expect(MockitoException.class);
describeCommand.run(mockCli);
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class PGExportTest method setUpInternal.
@Override
public void setUpInternal() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
cli.setGeogig(geogig);
// Add points
insertAndAdd(points1);
insertAndAdd(points2);
insertAndAdd(points3);
geogig.command(CommitOp.class).call();
// Add lines
insertAndAdd(lines1);
insertAndAdd(lines2);
insertAndAdd(lines3);
geogig.command(CommitOp.class).call();
}
use of jline.console.ConsoleReader in project GeoGig by boundlessgeo.
the class PGImportTest method setUp.
@Before
public void setUp() throws Exception {
ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
cli = new GeogigCLI(consoleReader);
setUpGeogig(cli);
}
Aggregations