/*
* Get guiced and get the environment service
*/
Injector injector = Guice.createInjector(new ToolsModule());
ICommandService commandService = injector.getInstance(ICommandService.class);
/*
* Get our options. We've got a problem with scripts breaking apart arguments
* that include spaces... so we manually rebuild it here
*/
String[] realArgs = args.length > 1 ? Arrays.copyOfRange(args, 2, args.length) : null;
String repackagedArgs = " ";
for (String arg : realArgs) repackagedArgs += arg + " ";
List<String> optionArgs = new ArrayList<String>();
for (String splitArg : repackagedArgs.split(" -")) {
splitArg = splitArg.trim();
if (!splitArg.isEmpty()) optionArgs.add("-" + splitArg.trim());
}
/*
* Initialize our command service
*/
boolean goodEnv = commandService.initialize(verb, target,
optionArgs.toArray(new String[optionArgs.size()]));
if (!goodEnv) {
System.out.println(CR + "This is the first time you are running Adaptrex Tools." + CR + CR +
"Before you can run the tools, you need to run \"adaptrex config environment\"" + CR +