public final class LsArguments extends Object implements Arguments<LsArguments>
ls
command.Constructor and Description |
---|
LsArguments()
Constructor to use if no options are specified.
|
LsArguments(LsOptions options)
Constructor with option set containing the selected command options.
|
LsArguments(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 operands for the command. |
File[] |
getFiles()
Returns the
<files> operand value: The files or directories used as starting point for the listing;
relative paths are not resolved (use the string path argument to
enable relative path resolving based on the current working
directory). |
LsArguments |
getForContext(ExecutionContext context)
Returns an arguments object for the given execution context with resolved
variables if necessary and possible.
|
LsOptions |
getOptions()
Returns the options set containing the selected command options.
|
String[] |
getPaths()
Returns the
<paths> operand value: The files or directories used as starting point for the listing;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory. |
boolean |
isAllFiles()
Returns true if the
-- allFiles option
is set. |
boolean |
isArgsSet()
Returns true if the
<args> operand has been set. |
boolean |
isFilesSet()
Returns true if the
<files> operand has been set. |
boolean |
isHumanReadable()
Returns true if the
-- humanReadable option
is set. |
boolean |
isLongFormat()
Returns true if the
-- longFormat option
is set. |
boolean |
isPathsSet()
Returns true if the
<paths> operand has been set. |
boolean |
isRecurseSubdirs()
Returns true if the
-- recurseSubdirs option
is set. |
boolean |
isReverseOrder()
Returns true if the
-- reverseOrder option
is set. |
boolean |
isTimeSorted()
Returns true if the
-- timeSorted option
is set. |
void |
setFiles(File... files)
Sets
<files> : The files or directories used as starting point for the listing;
relative paths are not resolved (use the string path argument to
enable relative path resolving based on the current working
directory). |
void |
setPaths(String... paths)
Sets
<paths> : The files or directories used as starting point for the listing;
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 LsArguments()
public LsArguments(LsOptions options)
options
- the selected optionsNullPointerException
- if the argument is nullpublic LsArguments(String... args)
args
- string arguments for the commandNullPointerException
- if args is nullpublic LsOptions getOptions()
public LsArguments 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<LsArguments>
context
- the execution context providing access to variables and
converterspublic File[] getFiles()
<files>
operand value: The files or directories used as starting point for the listing;
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 files or directories used as starting point for the listing;
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: The files or directories used as starting point for the listing;
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>
: The files or directories used as starting point for the listing;
wildcards * and ? are supported; relative paths are resolved on the
basis of the current working directory.paths
- the value for the <paths>
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 "--paths" operand have to be prefixed with the operand
name (e.g. "--count" for a subsequent 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 isAllFiles()
--
allFiles
option
is set. The option is also known as -
a option.
Description: Lists all files in the given directory, including hidden files (those whose names start with \".\" in Unix). By default, these files are excluded from the list.
--allFiles
or -a
option is setpublic boolean isHumanReadable()
--
humanReadable
option
is set. The option is also known as -
h option.
Description: Print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.)
--humanReadable
or -h
option is setpublic boolean isLongFormat()
--
longFormat
option
is set. The option is also known as -
l option.
Description: Long format, displaying file types, permissions, number of hard links, owner, group, size, date, and filename.
--longFormat
or -l
option is setpublic boolean isRecurseSubdirs()
--
recurseSubdirs
option
is set. The option is also known as -
R option.
Description: Recursively lists subdirectories encountered.
--recurseSubdirs
or -R
option is setpublic boolean isReverseOrder()
--
reverseOrder
option
is set. The option is also known as -
r option.
Description: Reverses the order of the sort to get reverse collating sequence or oldest first.
--reverseOrder
or -r
option is setpublic boolean isTimeSorted()
--
timeSorted
option
is set. The option is also known as -
t option.
Description: Sorts with the primary key being time modified (most recently modified first) and the secondary key being filename in the collating sequence.
--timeSorted
or -t
option is setpublic String toString()
Arguments
toString
in interface Arguments<LsArguments>
toString
in class Object
Copyright © 2024. All rights reserved.