use of aQute.lib.collections.ExtList in project bnd by bndtools.
the class Main method run.
/**
* Main entry for the command line
*
* @param args
* @throws Exception
*/
public void run(String[] args) throws Exception {
CommandLine cl = new CommandLine(this);
ExtList<String> list = new ExtList<String>(args);
String help = cl.execute(this, "jpm", list);
check();
if (help != null)
err.println(help);
}
use of aQute.lib.collections.ExtList in project bnd by bndtools.
the class JustAnotherPackageManager method getVMs.
public SortedSet<JVM> getVMs() throws Exception {
TreeSet<JVM> set = new TreeSet<JVM>(JVM.comparator);
String list = settings.get(JPM_VMS_EXTRA);
if (list != null) {
ExtList<String> elist = new ExtList<String>(list.split("\\s*,\\s*"));
for (String dir : elist) {
File f = new File(dir);
JVM jvm = getPlatform().getJVM(f);
if (jvm == null) {
jvm = new JVM();
jvm.path = f.getCanonicalPath();
jvm.name = "Not a valid VM";
jvm.platformVersion = jvm.vendor = jvm.version = "";
}
set.add(jvm);
}
}
getPlatform().getVMs(set);
return set;
}
use of aQute.lib.collections.ExtList in project bnd by bndtools.
the class Processor method getHeader0.
private FileLine getHeader0(Pattern header, Pattern clause) throws Exception {
FileLine fl;
File f = getPropertiesFile();
if (f != null) {
// Find in "our" local file
fl = findHeader(f, header, clause);
if (fl != null)
return fl;
// Get the includes (actually should parse the header
// to see if they override or only provide defaults?
List<File> result = getIncluded();
if (result != null) {
ExtList<File> reversed = new ExtList<File>(result);
Collections.reverse(reversed);
for (File included : reversed) {
fl = findHeader(included, header);
if (fl != null)
return fl;
}
}
}
// Ok, not on this level ...
if (getParent() != null) {
fl = getParent().getHeader(header, clause);
if (fl != null)
return fl;
}
// Sometimes we do not have a file ...
if (f == null && parent != null)
f = parent.getPropertiesFile();
if (f == null)
return null;
return new FileLine(f, 0, 0);
}
use of aQute.lib.collections.ExtList in project bnd by bndtools.
the class AbstractConsoleApp method run.
/**
* Main entry
*
* @throws Exception
*/
public void run(String[] args) throws Exception {
try {
CommandLine cl = new CommandLine(this);
ExtList<String> list = new ExtList<String>(args);
String help = cl.execute(target, "_main", list);
check();
if (help != null)
err.println(help);
} finally {
err.flush();
out.flush();
}
}
use of aQute.lib.collections.ExtList in project bnd by bndtools.
the class ReplacerAdapter method ls.
String ls(String[] args, boolean relative) {
if (args.length < 2)
throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter");
File dir = IO.getFile(base, args[1]);
if (!dir.isAbsolute())
throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir);
if (!dir.exists())
throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir);
if (!dir.isDirectory())
throw new IllegalArgumentException("the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
for (int i = 2; i < args.length; i++) {
Glob filters = new Glob(args[i]);
filters.select(files);
}
ExtList<String> result = new ExtList<String>();
for (File file : files) result.add(relative ? file.getName() : file.getAbsolutePath().replace(File.separatorChar, '/'));
return result.join(",");
}
Aggregations