public final class CatArguments extends Object implements Arguments<CatArguments>
cat
command.Constructor and Description |
---|
CatArguments()
Constructor to use if no options are specified.
|
CatArguments(CatOptions options)
Constructor with option set containing the selected command options.
|
CatArguments(String... args)
Constructor string arguments encoding options and arguments, possibly
also containing variable expressions.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getArgs()
Returns the
<args> operand value: String arguments defining the options and file operands for the
command. |
File[] |
getFiles()
Returns the
<files> operand value: 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). |
CatArguments |
getForContext(ExecutionContext context)
Returns an arguments object for the given execution context with resolved
variables if necessary and possible.
|
Input[] |
getInputs()
Returns the
<inputs> operand value: The inputs to be printed. |
CatOptions |
getOptions()
Returns the options set containing the selected command options.
|
String[] |
getPaths()
Returns the
<paths> operand value: Path names of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory. |
boolean |
isArgsSet()
Returns true if the
<args> operand has been set. |
boolean |
isFilesSet()
Returns true if the
<files> operand has been set. |
boolean |
isInputsSet()
Returns true if the
<inputs> operand has been set. |
boolean |
isNumberLines()
Returns true if the
-- numberLines option
is set. |
boolean |
isNumberNonBlankLines()
Returns true if the
-- numberNonBlankLines option
is set. |
boolean |
isPathsSet()
Returns true if the
<paths> operand has been set. |
boolean |
isSqueezeEmptyLines()
Returns true if the
-- squeezeEmptyLines option
is set. |
void |
setFiles(File... files)
Sets
<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). |
void |
setInputs(Input... inputs)
Sets
<inputs> : The inputs to be printed. |
void |
setPaths(String... paths)
Sets
<paths> : Path names of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory. |
String |
toString()
Returns a string representation of the command arguments and options.
|
public CatArguments()
public CatArguments(CatOptions options)
options
- the selected optionsNullPointerException
- if the argument is nullpublic CatArguments(String... args)
args
- string arguments for the commandNullPointerException
- if args is nullpublic CatOptions getOptions()
public CatArguments getForContext(ExecutionContext context)
Arguments
this
arguments instance is simply returned.
If variables are present, they are resolved if such a variable is defined
in the VariableContext
returned by
context.
getVariableContext()
.
Values are converted if necessary with the ValueConverter
s
returned by
context.
getValueConverterFor(Class)
.
getForContext
in interface Arguments<CatArguments>
context
- the execution context providing access to variables and
converterspublic File[] getFiles()
<files>
operand value: 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).<files>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isFilesSet()
<files>
operand has been set.
Note that this method returns true even if null
was passed to the
setFiles(java.io.File[])
method.
<files>
operand has
been called at least oncepublic void setFiles(File... files)
<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).files
- the value for the <files>
operandpublic String[] getPaths()
<paths>
operand value: Path names of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory.<paths>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isPathsSet()
<paths>
operand has been set.
Note that this method returns true even if null
was passed to the
setPaths(String[])
method.
<paths>
operand has
been called at least oncepublic void setPaths(String... paths)
<paths>
: Path names of the input files to be printed; wildcards * and ? are
supported; relative paths are resolved on the basis of the current
working directory.paths
- the value for the <paths>
operandpublic Input[] getInputs()
<inputs>
operand value: The inputs to be printed.<inputs>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isInputsSet()
<inputs>
operand has been set.
Note that this method returns true even if null
was passed to the
setInputs(org.unix4j.io.Input[])
method.
<inputs>
operand has
been called at least oncepublic void setInputs(Input... inputs)
<inputs>
: The inputs to be printed.inputs
- the value for the <inputs>
operandpublic String[] getArgs()
<args>
operand value: 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.<args>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isArgsSet()
<args>
operand has been set.<args>
operand has
been called at least oncepublic boolean isNumberNonBlankLines()
--
numberNonBlankLines
option
is set. The option is also known as -
b option.
Description: Number the non-blank output lines, starting at 1.
--numberNonBlankLines
or -b
option is setpublic boolean isNumberLines()
--
numberLines
option
is set. The option is also known as -
n option.
Description: Number the output lines, starting at 1.
--numberLines
or -n
option is setpublic boolean isSqueezeEmptyLines()
--
squeezeEmptyLines
option
is set. The option is also known as -
s option.
Description: Squeeze multiple adjacent empty lines, causing the output to be single spaced.
--squeezeEmptyLines
or -s
option is setpublic String toString()
Arguments
toString
in interface Arguments<CatArguments>
toString
in class Object
Copyright © 2024. All rights reserved.