public final class XargsArguments extends Object implements Arguments<XargsArguments>
xargs
command.Constructor and Description |
---|
XargsArguments()
Constructor to use if no options are specified.
|
XargsArguments(String... args)
Constructor string arguments encoding options and arguments, possibly
also containing variable expressions.
|
XargsArguments(XargsOptions options)
Constructor with option set containing the selected command options.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getArgs()
Returns the
<args> operand value: String arguments defining the options and operands for the command. |
String |
getDelimiter()
Returns the
<delimiter> operand value (variables are NOT resolved): Input items are terminated by the specified characters. |
String |
getDelimiter(ExecutionContext context)
Returns the
<delimiter> (variables are resolved): Input items are terminated by the specified characters. |
String |
getEof()
Returns the
<eof> operand value (variables are NOT resolved): If the end of file string occurs as a line of input, the rest of the
input is ignored. |
String |
getEof(ExecutionContext context)
Returns the
<eof> (variables are resolved): If the end of file string occurs as a line of input, the rest of the
input is ignored. |
XargsArguments |
getForContext(ExecutionContext context)
Returns an arguments object for the given execution context with resolved
variables if necessary and possible.
|
int |
getMaxArgs()
Returns the
<maxArgs> operand value: Use at most maxArgs arguments per command invocation. |
long |
getMaxLines()
Returns the
<maxLines> operand value: Use at most maxLines nonblank input lines per command invocation. |
XargsOptions |
getOptions()
Returns the options set containing the selected command options.
|
boolean |
isArgsSet()
Returns true if the
<args> operand has been set. |
boolean |
isDelimiter0()
Returns true if the
-- delimiter0 option
is set. |
boolean |
isDelimiterSet()
Returns true if the
<delimiter> operand has been set. |
boolean |
isEofSet()
Returns true if the
<eof> operand has been set. |
boolean |
isExactArgs()
Returns true if the
-- exactArgs option
is set. |
boolean |
isMaxArgsSet()
Returns true if the
<maxArgs> operand has been set. |
boolean |
isMaxLinesSet()
Returns true if the
<maxLines> operand has been set. |
boolean |
isNoRunIfEmpty()
Returns true if the
-- noRunIfEmpty option
is set. |
boolean |
isVerbose()
Returns true if the
-- verbose option
is set. |
void |
setDelimiter(String delimiter)
Sets
<delimiter> : Input items are terminated by the specified characters. |
void |
setEof(String eof)
Sets
<eof> : If the end of file string occurs as a line of input, the rest of the
input is ignored. |
void |
setMaxArgs(int maxArgs)
Sets
<maxArgs> : Use at most maxArgs arguments per command invocation. |
void |
setMaxLines(long maxLines)
Sets
<maxLines> : Use at most maxLines nonblank input lines per command invocation. |
String |
toString()
Returns a string representation of the command arguments and options.
|
public XargsArguments()
public XargsArguments(XargsOptions options)
options
- the selected optionsNullPointerException
- if the argument is nullpublic XargsArguments(String... args)
args
- string arguments for the commandNullPointerException
- if args is nullpublic XargsOptions getOptions()
public XargsArguments 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<XargsArguments>
context
- the execution context providing access to variables and
converterspublic String getDelimiter()
<delimiter>
operand value (variables are NOT resolved): Input items are terminated by the specified characters.<delimiter>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setgetDelimiter(ExecutionContext)
public String getDelimiter(ExecutionContext context)
<delimiter>
(variables are resolved): Input items are terminated by the specified characters.context
- the execution context used to resolve variables<delimiter>
operand value after resolving variablesIllegalStateException
- if this operand has never been setgetDelimiter()
public boolean isDelimiterSet()
<delimiter>
operand has been set.
Note that this method returns true even if null
was passed to the
setDelimiter(String)
method.
<delimiter>
operand has
been called at least oncepublic void setDelimiter(String delimiter)
<delimiter>
: Input items are terminated by the specified characters.delimiter
- the value for the <delimiter>
operandpublic String getEof()
<eof>
operand value (variables are NOT resolved): If the end of file string occurs as a line of input, the rest of the
input is ignored.<eof>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setgetEof(ExecutionContext)
public String getEof(ExecutionContext context)
<eof>
(variables are resolved): If the end of file string occurs as a line of input, the rest of the
input is ignored.context
- the execution context used to resolve variables<eof>
operand value after resolving variablesIllegalStateException
- if this operand has never been setgetEof()
public boolean isEofSet()
<eof>
operand has been set.
Note that this method returns true even if null
was passed to the
setEof(String)
method.
<eof>
operand has
been called at least oncepublic void setEof(String eof)
<eof>
: If the end of file string occurs as a line of input, the rest of the
input is ignored.eof
- the value for the <eof>
operandpublic long getMaxLines()
<maxLines>
operand value: Use at most maxLines nonblank input lines per command invocation.<maxLines>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isMaxLinesSet()
<maxLines>
operand has been set.
Note that this method returns true even if null
was passed to the
setMaxLines(long)
method.
<maxLines>
operand has
been called at least oncepublic void setMaxLines(long maxLines)
<maxLines>
: Use at most maxLines nonblank input lines per command invocation.maxLines
- the value for the <maxLines>
operandpublic int getMaxArgs()
<maxArgs>
operand value: Use at most maxArgs arguments per command invocation.<maxArgs>
operand value (variables are not resolved)IllegalStateException
- if this operand has never been setpublic boolean isMaxArgsSet()
<maxArgs>
operand has been set.
Note that this method returns true even if null
was passed to the
setMaxArgs(int)
method.
<maxArgs>
operand has
been called at least oncepublic void setMaxArgs(int maxArgs)
<maxArgs>
: Use at most maxArgs arguments per command invocation.maxArgs
- the value for the <maxArgs>
operandpublic String[] getArgs()
<args>
operand value: 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 "--maxArgs" operand have to be prefixed with the operand
name (e.g. "--maxLines" for a subsequent line count operand value).<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 isDelimiter0()
--
delimiter0
option
is set. The option is also known as -
z option.
Description: Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is treated like any other argument. Useful when input items might contain white space, quote marks, or backslashes. The find --print0 option produces input suitable for this mode.
(This option is ignored if an explicit delimiter operand is specified).
--delimiter0
or -z
option is setpublic boolean isExactArgs()
--
exactArgs
option
is set. The option is also known as -
x option.
Description: Terminate immediately if maxArgs
is specified but the found
number of variable items is less than maxArgs
.
(This option is ignored if no maxArgs
operand is specified).
--exactArgs
or -x
option is setpublic boolean isNoRunIfEmpty()
--
noRunIfEmpty
option
is set. The option is also known as -
r option.
Description: If the standard input does not contain any nonblanks, do not run the command. Normally, the command is run once even if there is no input.
--noRunIfEmpty
or -r
option is setpublic boolean isVerbose()
--
verbose
option
is set. The option is also known as -
t option.
Description: Print the command line on the standard error output before executing it.
--verbose
or -t
option is setpublic String toString()
Arguments
toString
in interface Arguments<XargsArguments>
toString
in class Object
Copyright © 2024. All rights reserved.