Package org.jboss.fresh.shell.commands

Source Code of org.jboss.fresh.shell.commands.EchosExe

package org.jboss.fresh.shell.commands;

import org.jboss.fresh.io.BufferObjectWriter;
import org.jboss.fresh.io.BufferWriter;
import org.jboss.fresh.shell.AbstractExecutable;

import java.io.PrintWriter;

// EX OK

public class EchosExe extends AbstractExecutable {
  private static transient org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(EchosExe.class);

  /**
   Sents the parameters we specified to the standard out Buffer.
   */
  public void process(String exepath, String[] params) throws Exception {
    log.debug("entered");

    if (helpRequested()) {
      PrintWriter out = new PrintWriter(new BufferWriter(getStdOut()));
      out.print("Usage: echo [--help] [params]\n");
      out.print("    params : parameters to be sent to the pipeline.\n");
      out.print("    --help : this help\n");
      out.close();
      log.debug("done.");
      return;
    }

    BufferObjectWriter bout = new BufferObjectWriter(getStdOut());

    for (int i = 0; i < params.length; i++) {
      bout.writeObject(params[i]);
    }

    bout.close();
    log.debug("done");
  }
}
TOP

Related Classes of org.jboss.fresh.shell.commands.EchosExe

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.