use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.
the class bnd method _bash.
@Description("Generate autocompletion file for bash")
public void _bash(Options options) throws Exception {
File tmp = File.createTempFile("bnd-completion", ".tmp");
tmp.deleteOnExit();
try {
IO.copy(getClass().getResource("bnd-completion.bash"), tmp);
Sed sed = new Sed(tmp);
sed.setBackup(false);
Reporter r = new ReporterAdapter();
CommandLine c = new CommandLine(r);
Map<String, Method> commands = c.getCommands(this);
StringBuilder sb = new StringBuilder();
for (String commandName : commands.keySet()) {
sb.append(" " + commandName);
}
sb.append(" help");
sed.replace("%listCommands%", sb.toString().substring(1));
sed.doIt();
IO.copy(tmp, out);
} finally {
IO.delete(tmp);
}
}
use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.
the class JPMTest method testVM.
public void testVM() throws Exception {
File tmp = new File("tmp");
IO.delete(tmp);
tmp.mkdirs();
File home = new File(tmp, "home");
File bin = new File(tmp, "bin");
System.setProperty("jpm.intest", "true");
JustAnotherPackageManager jpm = new JustAnotherPackageManager(new ReporterAdapter(), null, home, bin);
SortedSet<JVM> vms = jpm.getVMs();
assertNotNull(vms);
assertTrue(vms.size() >= 1);
System.out.println(vms);
File f = IO.getFile("~/jdk1.8");
if (f.isDirectory()) {
JVM jvm = jpm.addVm(f);
assertNotNull(jvm);
}
}
use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.
the class Platform method parseCompletion.
public void parseCompletion(Object target, File f) throws Exception {
IO.copy(getClass().getResource("unix/jpm-completion.bash"), f);
Sed sed = new Sed(f);
sed.setBackup(false);
Reporter r = new ReporterAdapter();
CommandLine c = new CommandLine(r);
Map<String, Method> commands = c.getCommands(target);
StringBuilder sb = new StringBuilder();
for (String commandName : commands.keySet()) {
sb.append(" " + commandName);
}
sb.append(" help");
sed.replace("%listJpmCommands%", sb.toString().substring(1));
sed.doIt();
}
use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.
the class UTF8PropertiesTest method testEmptyKey.
public void testEmptyKey() throws IOException {
UTF8Properties p = new UTF8Properties();
ReporterAdapter ra = new ReporterAdapter();
p.load(//
" -runvm: \n" + "#\"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044\"", null, ra);
assertEquals("", p.get("-runvm"));
assertEquals(1, p.size());
}
use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.
the class UTF8PropertiesTest method testNewlineCr.
public void testNewlineCr() throws IOException {
UTF8Properties p = new UTF8Properties();
ReporterAdapter ra = new ReporterAdapter();
p.load("a=2\n\rb=3\n\r", null, ra);
assertEquals("2", p.get("a"));
assertEquals("3", p.get("b"));
assertEquals(2, p.size());
}
Aggregations