public enum LsOption extends Enum<LsOption> implements Option, LsOptions
ls
command.
For most applications, it may be more convenient to use Ls.Options
instead of the option constants defined here.
-a | --allFiles | 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. | |||
-h | --humanReadable | Print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) | |||
-l | --longFormat | Long format, displaying file types, permissions, number of hard links, owner, group, size, date, and filename. | |||
-R | --recurseSubdirs | Recursively lists subdirectories encountered. | |||
-r | --reverseOrder | Reverses the order of the sort to get reverse collating sequence or oldest first. | |||
-t | --timeSorted | Sorts with the primary key being time modified (most recently modified first) and the secondary key being filename in the collating sequence. |
LsOptions.Default
Enum Constant and Description |
---|
allFiles
Option
--allFiles , -a :
Lists all files in the given directory, including hidden files
(those whose names start with \".\" in Unix). |
humanReadable
Option
--humanReadable , -h :
Print sizes in human readable format. |
longFormat
Option
--longFormat , -l :
Long format, displaying file types, permissions, number of hard
links, owner, group, size, date, and filename. |
recurseSubdirs
Option
--recurseSubdirs , -R :
Recursively lists subdirectories encountered. |
reverseOrder
Option
--reverseOrder , -r :
Reverses the order of the sort to get reverse collating sequence or
oldest first. |
timeSorted
Option
--timeSorted , -t :
Sorts with the primary key being time modified (most recently
modified first) and the secondary key being filename in the
collating sequence. |
Modifier and Type | Method and Description |
---|---|
char |
acronym()
Returns a one letter acronym for this option.
|
EnumSet<LsOption> |
asSet()
Returns a new set with
this active option. |
static LsOption |
findByAcronym(char acronym)
Returns the option with the given
acronym , or null if no
such option is found. |
boolean |
isSet(LsOption option)
Returns true if the specified
option is set and false otherwise |
Iterator<LsOption> |
iterator()
Returns an immutable iterator returning o single element:
this
option. |
Class<LsOption> |
optionType()
Returns the option type class, usually an enum.
|
int |
size()
Returns 1 as this is a set with a single element:
this option |
boolean |
useAcronymFor(LsOption option)
Returns true if the
acronym should be used for
the specified option in string representations. |
static LsOption |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static LsOption[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
forEach, spliterator
public static final LsOption allFiles
--allFiles
, -a
:
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.public static final LsOption humanReadable
--humanReadable
, -h
:
Print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.)public static final LsOption longFormat
--longFormat
, -l
:
Long format, displaying file types, permissions, number of hard
links, owner, group, size, date, and filename.public static final LsOption recurseSubdirs
--recurseSubdirs
, -R
:
Recursively lists subdirectories encountered.public static final LsOption reverseOrder
--reverseOrder
, -r
:
Reverses the order of the sort to get reverse collating sequence or
oldest first.public static final LsOption timeSorted
--timeSorted
, -t
:
Sorts with the primary key being time modified (most recently
modified first) and the secondary key being filename in the
collating sequence.public static LsOption[] values()
for (LsOption c : LsOption.values()) System.out.println(c);
public static LsOption valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic Class<LsOption> optionType()
OptionSet
optionType
in interface OptionSet<LsOption>
public static LsOption findByAcronym(char acronym)
acronym
, or null
if no
such option is found.acronym
- the option acronym
acronym
or null
if it
is not foundpublic char acronym()
Option
public boolean isSet(LsOption option)
OptionSet
option
is set and false otherwisepublic Iterator<LsOption> iterator()
this
option.public int size()
this
optionpublic boolean useAcronymFor(LsOption option)
acronym
should be used for
the specified option
in string representations.
This method returns always true for all options.
useAcronymFor
in interface OptionSet<LsOption>
option
- the option of interestCopyright © 2024. All rights reserved.