Package org.platformlayer.client.cli.commands

Source Code of org.platformlayer.client.cli.commands.ListRoots

package org.platformlayer.client.cli.commands;

import java.io.PrintWriter;

import org.platformlayer.PlatformLayerClient;
import org.platformlayer.PlatformLayerClientException;
import org.platformlayer.client.cli.output.UntypedItemFormatter;
import org.platformlayer.common.UntypedItem;

import com.fathomdb.cli.commands.Ansi;

public class ListRoots extends PlatformLayerCommandRunnerBase {
  public ListRoots() {
    super("list", "roots");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    return client.listRoots();
  }

  @Override
  public void formatRaw(Object o, PrintWriter writer) {
    Ansi ansi = new Ansi(writer);

    Iterable<UntypedItem> items = (Iterable<UntypedItem>) o;
    for (UntypedItem item : items) {
      UntypedItemFormatter.formatItem(item, ansi, true);
    }

    ansi.reset();
  }

}
TOP

Related Classes of org.platformlayer.client.cli.commands.ListRoots

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.