All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unix4j.unix.Cut Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
package org.unix4j.unix;

import org.unix4j.command.CommandInterface;

import org.unix4j.unix.cut.CutFactory;
import org.unix4j.unix.cut.CutOption;
import org.unix4j.unix.cut.CutOptions;
import org.unix4j.unix.cut.CutOptionSets;

/**
 * Non-instantiable module with inner types making up the cut command.
 * 

* NAME *

* cut - remove sections from each line of the input *

* SYNOPSIS *

*

* * * * * * * *
{@code cut }
{@code cut [-cf] }
{@code cut [-cf] }
{@code cut [-cf] }
{@code cut [-cf] }
{@code cut [-cf] }
{@code cut [-cf] }
*

* See {@link Interface} for the corresponding command signature methods. *

* DESCRIPTION *

*

Print selected parts of lines from the input to the output.

* *

* Options *

* The following options are supported: *

*

* * *
{@code -c}  {@code --chars} The list specifies character positions.
{@code -f}  {@code --fields} The list specifies fields, separated in the input by the field delimiter character (see the -d option.) Output fields are separated by a single occurrence of the field delimiter character.
*

* OPERANDS *

* The following operands are supported: *

*

* * * * * * *
{@code } : {@code String} use as the output delimiter the default is to use the input delimiter
{@code } : {@code char} use as the output delimiter the default is to use the input delimiter
{@code } : {@code int...} select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1.
{@code } : {@code org.unix4j.util.Range} select only these fields
{@code } : {@code String...} String arguments defining the options and operands for the command. Options can be specified by acronym (with a leading dash "-") or by long name (with two leading dashes "--"). Operands other than the default "--range" operand have to be prefixed with the operand name (e.g. "--indexes" for subsequent index operand values).
{@code } : {@code CutOptions} options for the cut command
*/ public final class Cut { /** * The "cut" command name. */ public static final String NAME = "cut"; /** * Interface defining all method signatures for the "cut" 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 { /** * Cuts the fields or characters from the input line and writes them to the standard output. Depending on the provided options and operands, range, delimiter or indexes define the cut. * * @param args String arguments defining the options and operands for the command. Options can be specified by acronym (with a leading dash "-") or by long name (with two leading dashes "--"). Operands other than the default "--range" operand have to be prefixed with the operand name (e.g. "--indexes" for subsequent index operand values). * @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 cut(String... args); /** * Cuts the fields or characters using the given range from the input line and writes them to the output. * * @param options options for the cut command * @param range select only these fields * @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 cut(CutOptions options, org.unix4j.util.Range range); /** * Cuts the fields or characters using the given indexes from the input line and writes them to the output. * * @param options options for the cut command * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. * @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 cut(CutOptions options, int... indexes); /** * Cuts the fields using the given range from the input line and writes them to the output. * * @param options options for the cut command * @param delimiter use as the output delimiter the default is to use the input delimiter * @param range select only these fields * @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 cut(CutOptions options, String delimiter, org.unix4j.util.Range range); /** * Cuts the fields using the given indexes from the input line and writes them to the output. * * @param options options for the cut command * @param delimiter use as the output delimiter the default is to use the input delimiter * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. * @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 cut(CutOptions options, String delimiter, int... indexes); /** * Cuts the fields using the given range and using the given delimiter from the input line and writes them to the output using the given outputDelimiter. * * @param options options for the cut command * @param delimiter use as the output delimiter the default is to use the input delimiter * @param outputDelimiter use as the output delimiter the default is to use the input delimiter * @param range select only these fields * @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 cut(CutOptions options, String delimiter, char outputDelimiter, org.unix4j.util.Range range); /** * Cuts the fields using the given indexes and using the given delimiter from the input line and writes them to the output using the given outputDelimiter. * * @param options options for the cut command * @param delimiter use as the output delimiter the default is to use the input delimiter * @param outputDelimiter use as the output delimiter the default is to use the input delimiter * @param indexes select these chars/field based on the given indexes. Indexes are 1 based. i.e. the first character/field on a line has an index of 1. * @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 cut(CutOptions options, String delimiter, char outputDelimiter, int... indexes); } /** * Options for the "cut" command: {@link CutOption#chars c}, {@link CutOption#fields f}. *

*

* * *
{@code -c}  {@code --chars} The list specifies character positions.
{@code -f}  {@code --fields} The list specifies fields, separated in the input by the field delimiter character (see the -d option.) Output fields are separated by a single occurrence of the field delimiter character.
*/ public static final CutOptionSets Options = CutOptionSets.INSTANCE; /** * Singleton {@link CutFactory factory} instance for the "cut" command. */ public static final CutFactory Factory = CutFactory.INSTANCE; // no instances private Cut() { super(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy