use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class PsCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Id");
table.column("Names");
table.column("Command");
table.column("Created");
table.column("Image");
table.column("Image ID");
table.column("Status");
table.column("State");
table.column("Ports");
table.column("Size");
table.column("Size Root");
for (Container container : getDockerService().ps(showAll, url)) {
StringBuilder portBuffer = new StringBuilder();
for (Port port : container.getPorts()) {
portBuffer.append(port.getType()).append(":").append(port.getPrivatePort()).append(":").append(port.getPublicPort()).append(" ");
}
table.addRow().addContent(container.getId(), container.getNames(), container.getCommand(), container.getCreated(), container.getImage(), container.getImageId(), container.getStatus(), container.getState(), portBuffer.toString(), container.getSizeRw(), container.getSizeRootFs());
}
table.print(System.out);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class SearchCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("Name");
table.column("Description");
table.column("Automated");
table.column("Official");
table.column("Star Count");
for (ImageSearch search : getDockerService().search(term, url)) {
table.addRow().addContent(search.getName(), search.getDescription(), search.isAutomated(), search.isOfficial(), search.getStarCount());
}
table.print(System.out);
return null;
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class ListProvidedFeaturesCommand method doExecute.
@Override
protected void doExecute(FeaturesService service) throws Exception {
ShellTable table = new ShellTable();
table.column("Name");
table.column("Version");
for (Feature feature : service.repositoryProvidedFeatures(featuresRepositoryUri)) {
table.addRow().addContent(feature.getName(), feature.getVersion());
}
table.print(System.out);
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class RepoListCommand method doExecute.
protected void doExecute(FeaturesService featuresService) throws Exception {
if (reload) {
reloadAllRepos(featuresService);
}
ShellTable table = new ShellTable();
table.column("Repository");
table.column("URL");
if (showBlacklisted) {
table.column("Blacklisted");
}
table.emptyTableText("No repositories available");
Repository[] repos = featuresService.listRepositories();
for (Repository repo : repos) {
if (repo != null) {
if (showBlacklisted || !repo.isBlacklisted()) {
Row row = table.addRow();
row.addContent(repo.getName(), repo.getURI().toString());
if (showBlacklisted) {
row.addContent(repo.isBlacklisted() ? "yes" : "no");
}
}
}
}
table.print(System.out, !noFormat);
}
use of org.apache.karaf.shell.support.table.ShellTable in project karaf by apache.
the class RequirementList method execute.
@Override
public Object execute() throws Exception {
Map<String, Set<String>> requirements = featuresService.listRequirements();
ShellTable table = new ShellTable();
table.column("Region");
table.column("Requirement");
table.emptyTableText("No requirements defined");
for (Map.Entry<String, Set<String>> entry : requirements.entrySet()) {
for (String requirement : entry.getValue()) {
table.addRow().addContent(entry.getKey(), requirement);
}
}
table.print(System.out, !noFormat);
return null;
}
Aggregations