org.unix4j.unix.Echo Maven / Gradle / Ivy
package org.unix4j.unix;
import org.unix4j.command.CommandInterface;
import org.unix4j.unix.echo.EchoFactory;
import org.unix4j.unix.echo.EchoOption;
import org.unix4j.unix.echo.EchoOptions;
import org.unix4j.unix.echo.EchoOptionSets;
/**
* Non-instantiable module with inner types making up the echo command.
*
* NAME
*
* echo - write arguments to standard output
*
* SYNOPSIS
*
*
* {@code echo }
* {@code echo [-n] }
* {@code echo [-n] }
*
*
* See {@link Interface} for the corresponding command signature methods.
*
* DESCRIPTION
*
*
The echo utility writes any specified operands, separated by single blank ({@code ' '}) characters and followed by a line ending, to the standard output. The line ending is usually one or two characters depending on the operating system where the command is run.
*
*
* Options
*
* The following options are supported:
*
*
* {@code -n} {@code --noNewline} Do not print the trailing newline character(s).
*
*
* OPERANDS
*
* The following operands are supported:
*
*
* {@code } : {@code String} A string to be written to standard output.
* {@code } : {@code String...} Strings to be written to standard output, separated by single blank
characters.
* {@code } : {@code String...} String arguments defining the options for the command and the
strings to be written to the output. Options can be specified by
acronym (with a leading dash "-") or by long name (with two leading
dashes "--").
* {@code } : {@code EchoOptions} Options for the echo command.
*
*/
public final class Echo {
/**
* The "echo" command name.
*/
public static final String NAME = "echo";
/**
* Interface defining all method signatures for the "echo" command.
*
* @param
* the generic return type for all command signature methods
* to support different implementor types; the methods of a
* command factory for instance returns a command instance;
* command builders can also implement this interface, but their
* methods return the builder itself enabling for chained method
* invocation to create joined commands
*/
public static interface Interface extends CommandInterface {
/**
* Writes any of the specified strings, separated by single blank
({@code ' '}) characters to the standard output suppressing the
trailing line ending if the {@code "-n"} option is specified.
*
* @param args String arguments defining the options for the command and the
strings to be written to the output. Options can be specified by
acronym (with a leading dash "-") or by long name (with two leading
dashes "--").
* @return the generic type {@code } defined by the implementing class;
* the command itself returns no value and writes its result to the
* standard output; see class level parameter comments for more
* details
*/
R echo(String... args);
/**
* Writes the specified string followed by a newline character to
the standard output suppressing the trailing line ending if the
{@code -n} option is specified.
*
* @param options Options for the echo command.
* @param string A string to be written to standard output.
* @return the generic type {@code } defined by the implementing class;
* the command itself returns no value and writes its result to the
* standard output; see class level parameter comments for more
* details
*/
R echo(EchoOptions options, String string);
/**
* Writes any of the specified strings, separated by single blank
({@code ' '}) characters to the standard output suppressing the
trailing line ending if the {@code -n} option is specified.
*
* @param options Options for the echo command.
* @param strings Strings to be written to standard output, separated by single blank
characters.
* @return the generic type {@code } defined by the implementing class;
* the command itself returns no value and writes its result to the
* standard output; see class level parameter comments for more
* details
*/
R echo(EchoOptions options, String... strings);
}
/**
* Options for the "echo" command: {@link EchoOption#noNewline n}.
*
*
* {@code -n} {@code --noNewline} Do not print the trailing newline character(s).
*
*/
public static final EchoOptionSets Options = EchoOptionSets.INSTANCE;
/**
* Singleton {@link EchoFactory factory} instance for the "echo" command.
*/
public static final EchoFactory Factory = EchoFactory.INSTANCE;
// no instances
private Echo() {
super();
}
}