use of aQute.lib.getopt.CommandLine in project bnd by bndtools.
the class Main method _generate.
@Description("Generate additional files for jpm")
public void _generate(GenerateOptions opts) throws Exception {
if (opts._arguments().isEmpty()) {
error("Syntax: jpm generate <markdown|bash-completion>");
return;
}
String genType = opts._arguments().get(0);
if (genType.equalsIgnoreCase("markdown")) {
IO.copy(this.getClass().getResourceAsStream("/static/jpm_prefix.md"), out);
CommandLine cl = new CommandLine(this);
cl.generateDocumentation(this, out);
} else if (genType.equalsIgnoreCase("bash-completion")) {
jpm.getPlatform().parseCompletion(this, out);
// IO.copy(this.getClass().getResourceAsStream("/aQute/jpm/platform/unix/jpm-completion.bash"),
// out);
} else {
error("Syntax: jpm generate <markdown|bash-completion>");
return;
}
}
use of aQute.lib.getopt.CommandLine 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.getopt.CommandLine in project bnd by bndtools.
the class bnd method start.
public void start(String[] args) throws Exception {
CommandLine cl = new CommandLine(this);
String help = cl.execute(this, "bnd", new ExtList<String>(args));
check();
if (help != null)
err.println(help);
}
use of aQute.lib.getopt.CommandLine in project bnd by bndtools.
the class bnd method _changes.
public void _changes(ChangesOptions options) {
boolean first = true;
Justif j = new Justif(80, 10);
Formatter f = j.formatter();
for (Map.Entry<Version, String[]> e : About.CHANGES.entrySet()) {
if (options.all() || first) {
f.format("$-\nRelease %s\n$-\n", e.getKey());
for (String s : e.getValue()) {
f.format("- \t1%s", s.replace('\n', '\f'));
Matcher m = BND_COMMAND_P.matcher(s);
while (m.find()) {
Formatter ff = new Formatter();
ff.format("\n\n");
CommandLine cli = options._command();
cli.help(ff, this, m.group(1));
j.indent(10, ff.out().toString());
}
m = BUG_P.matcher(s);
while (m.find()) {
f.format("\f-> https://github.com/bndtools/bnd/issues/%s", m.group(1));
}
f.format("\n\n");
}
}
first = false;
}
j.wrap();
out.println(f.out());
}
use of aQute.lib.getopt.CommandLine in project bnd by bndtools.
the class bnd method _add.
@Description("Add a workspace, or a project or a plugin to the workspace")
public void _add(AddOptions opts) throws Exception {
List<String> args = opts._arguments();
String what = args.remove(0);
if ("project".equals(what)) {
Workspace ws = Workspace.findWorkspace(getBase());
if (ws == null) {
error("No workspace found from %s", getBase());
return;
}
for (String pname : args) {
ws.createProject(pname);
}
getInfo(ws);
return;
}
if ("workspace".equals(what)) {
for (String pname : args) {
File wsdir = getFile(pname);
ws = Workspace.createWorkspace(wsdir);
if (ws == null) {
error("Could not create workspace");
}
}
getInfo(ws);
return;
}
if ("plugin".equals(what)) {
Workspace ws = getWorkspace(getBase());
if (ws == null) {
error("No workspace found from %s", getBase());
return;
}
CommandLine cl = new CommandLine(this);
String help = cl.execute(new Plugins(this, ws), "add", new ExtList<String>(args));
if (help != null)
out.println(help);
getInfo(ws);
return;
}
}
Aggregations