org.unix4j.unix.Cat Maven / Gradle / Ivy
package org.unix4j.unix;
import org.unix4j.command.CommandInterface;
import org.unix4j.unix.cat.CatFactory;
import org.unix4j.unix.cat.CatOption;
import org.unix4j.unix.cat.CatOptions;
import org.unix4j.unix.cat.CatOptionSets;
/**
* Non-instantiable module with inner types making up the cat command.
*
* NAME
*
* cat - concatenate and print files
*
* SYNOPSIS
*
*
* {@code cat}
* {@code cat }
* {@code cat }
* {@code cat [-bns]}
* {@code cat [-bns] }
* {@code cat [-bns] }
*
*
* See {@link Interface} for the corresponding command signature methods.
*
* DESCRIPTION
*
*
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command-argument order. If no file argument is specified, cat reads from the standard input.
*
*
* Options
*
* The following options are supported:
*
*
* {@code -b} {@code --numberNonBlankLines} Number the non-blank output lines, starting at 1.
* {@code -n} {@code --numberLines} Number the output lines, starting at 1.
* {@code -s} {@code --squeezeEmptyLines} Squeeze multiple adjacent empty lines, causing the output to be
single spaced.
*
*
* OPERANDS
*
* The following operands are supported:
*
*
* {@code } : {@code java.io.File...} The input files to be printed; relative paths are not resolved (use
the string path argument to enable relative path resolving based on
the current working directory).
* {@code } : {@code String...} Pathnames of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory.
* {@code } : {@code String...} String arguments defining the options and file operands for the
command. Options can be specified by acronym (with a leading dash
"-") or by long name (with two leading dashes "--"). File arguments
are expanded if wildcards are used.
* {@code } : {@code CatOptions} Options for the cat command.
*
*/
public final class Cat {
/**
* The "cat" command name.
*/
public static final String NAME = "cat";
/**
* Interface defining all method signatures for the "cat" 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 {
/**
* Reads the lines from the standard input and writes them to the
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 cat();
/**
* Reads the lines from files specified as arguments and writes them to
the standard output. Options can be specified by acronym (with a
leading dash "-") or by long name (with two leading dashes "--").
File arguments are expanded if wildcards are used. All file
arguments are processed in command-argument order.
*
* @param args String arguments defining the options and file operands for the
command. Options can be specified by acronym (with a leading dash
"-") or by long name (with two leading dashes "--"). File arguments
are expanded if wildcards are used.
* @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 cat(String... args);
/**
* Reads the lines from the specified files and writes them to the
standard output. The files are processed in command-argument order.
*
* @param files The input files to be printed; relative paths are not resolved (use
the string path argument to enable relative path resolving based on
the current working directory).
* @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 cat(java.io.File... files);
/**
* Reads the lines from the standard input and writes them to the
standard output; the given options define the details of the output
format.
*
* @param options Options for the cat command.
* @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 cat(CatOptions options);
/**
* Reads the lines from the specified files and writes them to the
standard output; the given options define the details of the output
format. The files are processed in command-argument order.
*
* @param options Options for the cat command.
* @param files The input files to be printed; relative paths are not resolved (use
the string path argument to enable relative path resolving based on
the current working directory).
* @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 cat(CatOptions options, java.io.File... files);
/**
* Reads the lines from the specified files and writes them to the
standard output; the given options define the details of the output
format. The path arguments are expanded if wildcards are used and
processed in command-argument order.
*
* @param options Options for the cat command.
* @param paths Pathnames of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory.
* @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 cat(CatOptions options, String... paths);
}
/**
* Options for the "cat" command: {@link CatOption#numberNonBlankLines b}, {@link CatOption#numberLines n}, {@link CatOption#squeezeEmptyLines s}.
*
*
* {@code -b} {@code --numberNonBlankLines} Number the non-blank output lines, starting at 1.
* {@code -n} {@code --numberLines} Number the output lines, starting at 1.
* {@code -s} {@code --squeezeEmptyLines} Squeeze multiple adjacent empty lines, causing the output to be
single spaced.
*
*/
public static final CatOptionSets Options = CatOptionSets.INSTANCE;
/**
* Singleton {@link CatFactory factory} instance for the "cat" command.
*/
public static final CatFactory Factory = CatFactory.INSTANCE;
// no instances
private Cat() {
super();
}
}