Merge branch 'command-line'

Provides shell completion and makes all the command-line options consistent and complete.

Fixes #150, which tracked shell completion.
This commit is contained in:
Benjamin Sago 2017-05-06 23:00:52 +01:00
commit 897d6ffa56
8 changed files with 302 additions and 119 deletions

View File

@ -14,21 +14,21 @@ exas options are similar, but not exactly the same, as `ls`.
### Display Options ### Display Options
- **-1**, **--oneline**: display one entry per line - **-1**, **--oneline**: display one entry per line
- **-G**, **--grid**: display entries in a grid view (default) - **-G**, **--grid**: display entries as a grid (default)
- **-l**, **--long**: display extended details and attributes - **-l**, **--long**: display extended details and attributes
- **-R**, **--recurse**: recurse into directories - **-R**, **--recurse**: recurse into directories
- **-T**, **--tree**: recurse into subdirectories in a tree view - **-T**, **--tree**: recurse into directories as a tree
- **-x**, **--across**: sort multi-column view entries across - **-x**, **--across**: sort the grid across, rather than downwards
- **--color**, **--colour**: when to colourise the output - **--colo[u]r**: when to use terminal colours
- **--color-scale**, **--colour-scale**: colour file sizes according to their magnitude - **--colo[u]r-scale**: highlight levels of file sizes distinctly
### Filtering Options ### Filtering Options
- **-a**, **--all**: show dot files - **-a**, **--all**: don't hide hidden and 'dot' files
- **-d**, **--list-dirs**: list directories as regular files - **-d**, **--list-dirs**: list directories like regular files
- **-L**, **--level=(depth)**: maximum depth of recursion - **-L**, **--level=(depth)**: limit the depth of recursion
- **-r**, **--reverse**: reverse sort order - **-r**, **--reverse**: reverse the sort order
- **-s**, **--sort=(field)**: field to sort by - **-s**, **--sort=(field)**: which field to sort by
- **--group-directories-first**: list directories before other files - **--group-directories-first**: list directories before other files
- **-I**, **--ignore-glob=(globs)**: glob patterns (pipe-separated) of files to ignore - **-I**, **--ignore-glob=(globs)**: glob patterns (pipe-separated) of files to ignore
@ -36,23 +36,23 @@ exas options are similar, but not exactly the same, as `ls`.
These options are available when running with --long (`-l`): These options are available when running with --long (`-l`):
- **-b**, **--binary**: use binary (power of two) file sizes - **-b**, **--binary**: list file sizes with binary prefixes
- **-B**, **--bytes**: list file sizes in bytes, without prefixes - **-B**, **--bytes**: list file sizes in bytes, without any prefixes
- **-g**, **--group**: show group as well as user - **-g**, **--group**: list each file's group
- **-h**, **--header**: show a header row - **-h**, **--header**: add a header row to each column
- **-H**, **--links**: show number of hard links column - **-H**, **--links**: list each file's number of hard links
- **-i**, **--inode**: show inode number column - **-i**, **--inode**: list each file's inode number
- **-m**, **--modified**: display timestamp of most recent modification - **-m**, **--modified**: use the modified timestamp field
- **-S**, **--blocks**: show number of file system blocks - **-S**, **--blocks**: list each file's number of file system blocks
- **-t**, **--time=(field)**: which timestamp to show for a file - **-t**, **--time=(field)**: which timestamp field to use
- **-u**, **--accessed**: display timestamp of last access for a file - **-u**, **--accessed**: use the accessed timestamp field
- **-U**, **--created**: display timestamp of creation of a file - **-U**, **--created**: use the created timestamp field
- **-@**, **--extended**: display extended attribute keys and sizes - **-@**, **--extended**: list each file's extended attributes and sizes
- **--git**: show Git status for a file - **--git**: list each file's Git status, if tracked
Accepted **--color** options are **always**, **automatic**, and **never**. - Valid **--color** options are **always**, **automatic**, and **never**.
Valid sort fields are **name**, **size**, **extension**, **modified**, **accessed**, **created**, **inode**, and **none**. - Valid sort fields are **accessed**, **created**, **extension**, **Extension**, **inode**, **modified**, **name**, **Name**, **size**, and **none**. Fields starting with a capital letter are case-sensitive.
Valid time fields are **modified**, **accessed**, and **created**. - Valid time fields are **modified**, **accessed**, and **created**.
## Installation ## Installation

44
Vagrantfile vendored
View File

@ -7,6 +7,8 @@ Vagrant.configure(2) do |config|
v.cpus = 1 v.cpus = 1
end end
developer = 'ubuntu'
# We use Ubuntu instead of Debian because the image comes with two-way # We use Ubuntu instead of Debian because the image comes with two-way
# shared folder support by default. # shared folder support by default.
@ -16,8 +18,11 @@ Vagrant.configure(2) do |config|
# Install the dependencies needed for exa to build, as quietly as # Install the dependencies needed for exa to build, as quietly as
# apt can do. # apt can do.
config.vm.provision :shell, privileged: true, inline: config.vm.provision :shell, privileged: true, inline: <<-EOF
%[apt-get install -qq -o=Dpkg::Use-Pty=0 -y git cmake libgit2-dev curl attr pkg-config] apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
git cmake curl attr pkg-config libgit2-dev \
fish zsh bash bash-completion
EOF
# Guarantee that the timezone is UTC -- some of the tests # Guarantee that the timezone is UTC -- some of the tests
@ -38,13 +43,40 @@ Vagrant.configure(2) do |config|
# By default it just uses the one in /vagrant/target, which can # By default it just uses the one in /vagrant/target, which can
# cause problems if it has different permissions than the other # cause problems if it has different permissions than the other
# directories, or contains object files compiled for the host. # directories, or contains object files compiled for the host.
config.vm.provision :shell, privileged: false, inline: config.vm.provision :shell, privileged: false, inline: <<-EOF
%[echo "export CARGO_TARGET_DIR=/home/ubuntu/target" >> ~/.bashrc] function put_line() {
grep -q -F "$2" $1 || echo "$2" >> $1
}
put_line ~/.bashrc 'export CARGO_TARGET_DIR=/home/#{developer}/target'
EOF
# Create "dexa" and "rexa" scripts that run the debug and release
# compiled versions of exa.
config.vm.provision :shell, privileged: true, inline: <<-EOF
echo -e "#!/bin/sh\n/home/#{developer}/target/debug/exa \\$*" > /usr/bin/exa
echo -e "#!/bin/sh\n/home/#{developer}/target/release/exa \\$*" > /usr/bin/rexa
chmod +x /usr/bin/{exa,rexa}
EOF
# Link the completion files so theyre “installed”.
config.vm.provision :shell, privileged: true, inline: <<-EOF
test -h /etc/bash_completion.d/exa \
|| ln -s /vagrant/contrib/completions.bash /etc/bash_completion.d/exa
test -h /usr/share/zsh/vendor-completions/_exa \
|| ln -s /vagrant/contrib/completions.zsh /usr/share/zsh/vendor-completions/_exa
test -h /usr/share/fish/completions/exa.fish \
|| ln -s /vagrant/contrib/completions.fish /usr/share/fish/completions/exa.fish
EOF
# We create two users that own the test files. # We create two users that own the test files.
# The first one just owns the ordinary ones, because we dont want to # The first one just owns the ordinary ones, because we dont want the
# depend on “vagrant” or “ubuntu” existing. # test outputs to depend on “vagrant” or “ubuntu” existing.
user = "cassowary" user = "cassowary"
config.vm.provision :shell, privileged: true, inline: config.vm.provision :shell, privileged: true, inline:
%[id -u #{user} &>/dev/null || useradd #{user}] %[id -u #{user} &>/dev/null || useradd #{user}]

37
contrib/completions.bash Normal file
View File

@ -0,0 +1,37 @@
_exa()
{
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-'?'|--help|-v|--version)
return
;;
-L|--level)
COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return
;;
-s|--sort)
COMPREPLY=( $( compgen -W 'name filename Name Filename size filesize extension Extension modified accessed created none inode --' -- "$cur" ) )
return
;;
-t|--time)
COMPREPLY=( $( compgen -W 'accessed modified created --' -- $cur ) )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
;;
*)
_filedir
;;
esac
} &&
complete -o filenames -o bashdefault -F _exa exa

62
contrib/completions.fish Normal file
View File

@ -0,0 +1,62 @@
# Meta-stuff
complete -c exa -s 'v' -l 'version' -d "Show version of exa"
complete -c exa -s '?' -l 'help' -d "Show list of command-line options"
# Display options
complete -c exa -s '1' -l 'oneline' -d "Display one entry per line"
complete -c exa -s 'l' -l 'long' -d "Display extended file metadata as a table"
complete -c exa -s 'G' -l 'grid' -d "Display entries in a grid"
complete -c exa -s 'x' -l 'across' -d "Sort the grid across, rather than downwards"
complete -c exa -s 'R' -l 'recurse' -d "Recurse into directories"
complete -c exa -s 'T' -l 'tree' -d "Recurse into directories as a tree"
complete -c exa -s 'F' -l 'classify' -d "Display type indicator by file names"
complete -c exa -l 'color' -d "When to use terminal colours"
complete -c exa -l 'colour' -d "When to use terminal colours"
complete -c exa -l 'color-scale' -d "Highlight levels of file sizes distinctly"
complete -c exa -l 'colour-scale' -d "Highlight levels of file sizes distinctly"
# Filtering and sorting options
complete -c exa -l 'group-directories-first' -d "Sort directories before other files"
complete -c exa -s 'a' -l 'all' -d "Don't hide hidden and 'dot' files"
complete -c exa -s 'd' -l 'list-dirs' -d "List directories like regular files"
complete -c exa -s 'L' -l 'level' -d "Limit the depth of recursion" -a "1 2 3 4 5 6 7 8 9"
complete -c exa -s 'r' -l 'reverse' -d "Reverse the sort order"
complete -c exa -s 's' -l 'sort' -x -d "Which field to sort by" -a "
accessed\t'Sort by file accessed time'
created\t'Sort by file modified time'
ext\t'Sort by file extension'
Ext\t'Sort by file extension (case-insensitive)'
extension\t'Sort by file extension'
Extension\t'Sort by file extension (case-insensitive)'
filename\t'Sort by filename'
Filename\t'Sort by filename (case-insensitive)'
inode\t'Sort by file inode'
modified\t'Sort by file modified time'
name\t'Sort by filename'
Name\t'Sort by filename (case-insensitive)'
none\t'Do not sort files at all'
size\t'Sort by file size'
"
complete -c exa -s 'I' -l 'ignore-glob' -d "Ignore files that match these glob patterns" -r
# Long view options
complete -c exa -s 'b' -l 'binary' -d "List file sizes with binary prefixes"
complete -c exa -s 'B' -l 'bytes' -d "List file sizes in bytes, without any prefixes"
complete -c exa -s 'g' -l 'group' -d "List each file's group"
complete -c exa -s 'h' -l 'header' -d "Add a header row to each column"
complete -c exa -s 'h' -l 'links' -d "List each file's number of hard links"
complete -c exa -s 'g' -l 'group' -d "List each file's inode number"
complete -c exa -s 'm' -l 'modified' -d "Use the modified timestamp field"
complete -c exa -s 'S' -l 'blocks' -d "List each file's number of filesystem blocks"
complete -c exa -s 't' -l 'time' -x -d "Which timestamp field to list" -a "
accessed\t'Display accessed time'
created\t'Display created time'
modified\t'Display modified time'
"
complete -c exa -s 'u' -l 'accessed' -d "Use the accessed timestamp field"
complete -c exa -s 'U' -l 'created' -d "Use the created timestamp field"
# Optional extras
complete -c exa -s 'g' -l 'git' -d "List each file's Git status, if tracked"
complete -c exa -s '@' -l 'extended' -d "List each file's extended attributes and sizes"

39
contrib/completions.zsh Normal file
View File

@ -0,0 +1,39 @@
#compdef exa
__exa() {
_arguments \
"(- 1 *)"{-v,--version}"[Show version of exa]" \
"(- 1 *)"{-\?,--help}"[Show list of command-line options]" \
{-1,--oneline}"[Display one entry per line]" \
{-l,--long}"[Display extended file metadata as a table]" \
{-G,--grid}"[Display entries as a grid]" \
{-x,--across}"[Sort the grid across, rather than downwards]" \
{-R,--recurse}"[Recurse into directories]" \
{-T,--tree}"[Recurse into directories as a tree]" \
{-F,--classify}"[Display type indicator by file names]" \
{--color,--colour}"[When to use terminal colours]" \
{--color,--colour}-scale"[Highlight levels of file sizes distinctly]" \
--group-directories-first"[Sort directories before other files]" \
{-a,--all}"[Don't hide hidden and 'dot' files]" \
{-d,--list-dirs}"[List directories like regular files]" \
{-L,--level}"+[Limit the depth of recursion]" \
{-r,--reverse}"[Reverse the sort order]" \
{-s,--sort}"[Which field to sort by]:(sort field):(accessed created extension Extension filename Filename inode modified name Name none size)" \
{-I,--ignore-glob}"[Ignore files that match these glob patterns]" \
{-b,--binary}"[List file sizes with binary prefixes]" \
{-B,--bytes}"[List file sizes in bytes, without any prefixes]" \
{-g,--group}"[List each file's group]" \
{-h,--header}"[Add a header row to each column]" \
{-H,--links}"[List each file's number of hard links]" \
{-i,--inode}"[List each file's inode number]" \
{-m,--modified}"[Use the modified timestamp field]" \
{-S,--blocks}"[List each file's number of filesystem blocks]" \
{-t,--time}"[Which time field to show]:(time field):(accessed created modified)" \
{-u,--accessed}"[Use the accessed timestamp field]" \
{-U,--created}"[Use the created timestamp field]" \
--git"[List each file's Git status, if tracked]" \
{-@,--extended}"[List each file's extended attributes and sizes]" \
'*:filename:_files'
}
__exa

View File

@ -1,5 +1,5 @@
.hy .hy
.TH "exa" "1" "2015\-10\-18" "exa 0.4.0" "" .TH "exa" "1" "2017\-05\-06" "exa 0.5.0" ""
.SH NAME .SH NAME
.PP .PP
exa \- a modern replacement for ls exa \- a modern replacement for ls
@ -23,12 +23,17 @@ display one entry per line
.RE .RE
.TP .TP
.B \-G, \-\-grid .B \-G, \-\-grid
display entries in a grid view (default) display entries as a grid (default)
.RS .RS
.RE .RE
.TP .TP
.B \-l, \-\-long .B \-l, \-\-long
display extended details and attributes display extended file metadata as a table
.RS
.RE
.TP
.B \-x, \-\-across
sort the grid across, rather than downwards
.RS .RS
.RE .RE
.TP .TP
@ -38,39 +43,45 @@ recurse into directories
.RE .RE
.TP .TP
.B \-T, \-\-tree .B \-T, \-\-tree
recurse into subdirectories in a tree view recurse into directories as a tree
.RS
.RE
.TP
.B \-x, \-\-across
sort multi\-column view entries across
.RS .RS
.RE .RE
.TP .TP
.B \-\-color, \-\-colour=\f[I]WHEN\f[] .B \-\-color, \-\-colour=\f[I]WHEN\f[]
when to colourise the output (always, automatic, never) when to use terminal colours (always, automatic, never)
.RS
.RE
.TP
.B \-\-color-scale, \-\-colour-scale
highlight levels of file sizes distinctly
.RS .RS
.RE .RE
.SH FILTERING AND SORTING OPTIONS .SH FILTERING AND SORTING OPTIONS
.TP .TP
.B \-a, \-\-all .B \-a, \-\-all
show dot\-files don\[aq]t hide hidden and \[aq]dot\[aq] files
.RS .RS
.RE .RE
.TP .TP
.B \-d, \-\-list\-dirs .B \-d, \-\-list\-dirs
list directories as regular files list directories like regular files
.RS .RS
.RE .RE
.TP .TP
.B \-r, \-\-reverse .B \-r, \-\-reverse
reverse order of files reverse the sort order
.RS .RS
.RE .RE
.TP .TP
.B \-s, \-\-sort=\f[I]WORD\f[] .B \-s, \-\-sort=\f[I]SORT_FIELD\f[]
field to sort by (name, size, extension, modified, accessed, created, which field to sort by.
inode, none) Valid fields are name, Name, extension, Extension, size, modified, accessed, created, inode, and none.
Fields starting with a capital letter are case-sensitive.
.RS
.RE
.TP
.B \-I, \-\-ignore\-glob=\f[I]GLOBS\f[]
Glob patterns, pipe-separated, of files to ignore
.RS .RS
.RE .RE
.TP .TP
@ -84,72 +95,72 @@ These options are available when running with \f[C]\-\-long\f[]
(\f[C]\-l\f[]): (\f[C]\-l\f[]):
.TP .TP
.B \-b, \-\-binary .B \-b, \-\-binary
use binary prefixes in file sizes list file sizes with binary prefixes
.RS .RS
.RE .RE
.TP .TP
.B \-B, \-\-bytes .B \-B, \-\-bytes
list file sizes in bytes, without prefixes list file sizes in bytes, without any prefixes
.RS .RS
.RE .RE
.TP .TP
.B \-g, \-\-group .B \-g, \-\-group
show group as well as user list each file\[aq]s group
.RS .RS
.RE .RE
.TP .TP
.B \-h, \-\-header .B \-h, \-\-header
show a header row at the top add a header row to each column
.RS .RS
.RE .RE
.TP .TP
.B \-H, \-\-links .B \-H, \-\-links
show number of hard links list each file\[aq]s number of hard links
.RS .RS
.RE .RE
.TP .TP
.B \-i, \-\-inode .B \-i, \-\-inode
show each file\[aq]s inode number list each file\[aq]s inode number
.RS .RS
.RE .RE
.TP .TP
.B \-L, \-\-level=\f[I]DEPTH\f[] .B \-L, \-\-level=\f[I]DEPTH\f[]
maximum depth of recursion limit the depth of recursion
.RS .RS
.RE .RE
.TP .TP
.B \-m, \-\-modified .B \-m, \-\-modified
display timestamp of most recent modification use the modified timestamp field
.RS .RS
.RE .RE
.TP .TP
.B \-S, \-\-blocks .B \-S, \-\-blocks
show number of file system blocks list each file\[aq]s number of file system blocks
.RS .RS
.RE .RE
.TP .TP
.B \-t, \-\-time=\f[I]WORD\f[] .B \-t, \-\-time=\f[I]WORD\f[]
which timestamp to show for a file (modified, accessed, created) which timestamp field to list (modified, accessed, created)
.RS .RS
.RE .RE
.TP .TP
.B \-u, \-\-accessed .B \-u, \-\-accessed
display timestamp of last access for a file use the accessed timestamp field
.RS .RS
.RE .RE
.TP .TP
.B \-U, \-\-created .B \-U, \-\-created
display timestamp of creation for a file use the created timestamp field
.RS .RS
.RE .RE
.TP .TP
.B \-\@, \-\-extended .B \-\@, \-\-extended
display extended attribute keys and sizes list each file\[aq]s extended attributes and sizes
.RS .RS
.RE .RE
.TP .TP
.B \-\-git .B \-\-git
display Git status for a file, if available list each file\[aq]s Git status, if tracked
.RS .RS
.RE .RE
.SH EXAMPLES .SH EXAMPLES

View File

@ -1,44 +1,46 @@
pub static OPTIONS: &'static str = r##" pub static OPTIONS: &'static str = r##"
-?, --help show list of command-line options
-v, --version show version of exa
DISPLAY OPTIONS DISPLAY OPTIONS
-1, --oneline display one entry per line -1, --oneline display one entry per line
-G, --grid display entries in a grid view (default) -l, --long display extended file metadata as a table
-l, --long display extended details and attributes -G, --grid display entries as a grid (default)
-x, --across sort the grid across, rather than downwards
-R, --recurse recurse into directories -R, --recurse recurse into directories
-T, --tree recurse into subdirectories in a tree view -T, --tree recurse into directories as a tree
-x, --across sort multi-column view entries across -F, --classify display type indicator by file names
-F, --classify show file type indicator (one of */=@|) --colo[u]r=WHEN when to use terminal colours (always, auto, never)
--colo[u]r-scale highlight levels of file sizes distinctly
--color=WHEN, --colour=WHEN when to colourise the output (always, auto, never)
--color-scale, --colour-scale colour file sizes according to their magnitude
FILTERING AND SORTING OPTIONS FILTERING AND SORTING OPTIONS
-a, --all show dot-files -a, --all don't hide hidden and 'dot' files
-d, --list-dirs list directories as regular files -d, --list-dirs list directories like regular files
-r, --reverse reverse order of files -r, --reverse reverse the sort order
-s, --sort SORT_FIELD field to sort by. Choices: name, -s, --sort SORT_FIELD which field to sort by:
size, extension, modified,
accessed, created, inode, none
--group-directories-first list directories before other files --group-directories-first list directories before other files
-I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore -I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore
Valid sort fields: name, Name, extension, Extension, size,
modified, accessed, created, inode, none
"##; "##;
pub static LONG_OPTIONS: &'static str = r##" pub static LONG_OPTIONS: &'static str = r##"
LONG VIEW OPTIONS LONG VIEW OPTIONS
-b, --binary use binary prefixes in file sizes -b, --binary list file sizes with binary prefixes
-B, --bytes list file sizes in bytes, without prefixes -B, --bytes list file sizes in bytes, without any prefixes
-g, --group show group as well as user -g, --group list each file's group
-h, --header show a header row at the top -h, --header add a header row to each column
-H, --links show number of hard links -H, --links list each file's number of hard links
-i, --inode show each file's inode number -i, --inode list each file's inode number
-L, --level DEPTH maximum depth of recursion -L, --level DEPTH limit the depth of recursion
-m, --modified display timestamp of most recent modification -m, --modified use the modified timestamp field
-S, --blocks show number of file system blocks -S, --blocks show number of file system blocks
-t, --time FIELD which timestamp to show for a file. Choices: -t, --time FIELD which timestamp field to list (modified, accessed, created)
modified, accessed, created -u, --accessed use the accessed timestamp field
-u, --accessed display timestamp of last access for a file -U, --created use the created timestamp field
-U, --created display timestamp of creation for a file
"##; "##;
pub static GIT_HELP: &'static str = r##" --git show git status for files"##; pub static GIT_HELP: &'static str = r##" --git list each file's Git status, if tracked"##;
pub static EXTENDED_HELP: &'static str = r##" -@, --extended display extended attribute keys and sizes"##; pub static EXTENDED_HELP: &'static str = r##" -@, --extended list each file's extended attributes and sizes"##;

View File

@ -45,50 +45,50 @@ impl Options {
where S: AsRef<OsStr> { where S: AsRef<OsStr> {
let mut opts = getopts::Options::new(); let mut opts = getopts::Options::new();
opts.optflag("v", "version", "display version of exa"); opts.optflag("v", "version", "show version of exa");
opts.optflag("?", "help", "show list of command-line options"); opts.optflag("?", "help", "show list of command-line options");
// Display options // Display options
opts.optflag("1", "oneline", "display one entry per line"); opts.optflag("1", "oneline", "display one entry per line");
opts.optflag("G", "grid", "display entries in a grid view (default)"); opts.optflag("l", "long", "display extended file metadata in a table");
opts.optflag("l", "long", "display extended details and attributes"); opts.optflag("G", "grid", "display entries as a grid (default)");
opts.optflag("x", "across", "sort the grid across, rather than downwards");
opts.optflag("R", "recurse", "recurse into directories"); opts.optflag("R", "recurse", "recurse into directories");
opts.optflag("T", "tree", "recurse into subdirectories in a tree view"); opts.optflag("T", "tree", "recurse into directories as a tree");
opts.optflag("x", "across", "sort multi-column view entries across"); opts.optflag("F", "classify", "display type indicator by file names (one of */=@|)");
opts.optflag("F", "classify", "show file type indicator (one of */=@|)"); opts.optopt ("", "color", "when to use terminal colours", "WHEN");
opts.optopt ("", "color", "when to show anything in colours", "WHEN"); opts.optopt ("", "colour", "when to use terminal colours", "WHEN");
opts.optopt ("", "colour", "when to show anything in colours (alternate spelling)", "WHEN"); opts.optflag("", "color-scale", "highlight levels of file sizes distinctly");
opts.optflag("", "color-scale", "use a colour scale when displaying file sizes (alternate spelling)"); opts.optflag("", "colour-scale", "highlight levels of file sizes distinctly");
opts.optflag("", "colour-scale", "use a colour scale when displaying file sizes");
// Filtering and sorting options // Filtering and sorting options
opts.optflag("", "group-directories-first", "list directories before other files"); opts.optflag("", "group-directories-first", "sort directories before other files");
opts.optflag("a", "all", "show dot-files"); opts.optflag("a", "all", "don't hide hidden and 'dot' files");
opts.optflag("d", "list-dirs", "list directories as regular files"); opts.optflag("d", "list-dirs", "list directories like regular files");
opts.optflag("r", "reverse", "reverse order of files"); opts.optopt ("L", "level", "limit the depth of recursion", "DEPTH");
opts.optopt ("s", "sort", "field to sort by", "WORD"); opts.optflag("r", "reverse", "reverse the sert order");
opts.optopt ("I", "ignore-glob", "patterns (|-separated) of names to ignore", "GLOBS"); opts.optopt ("s", "sort", "which field to sort by", "WORD");
opts.optopt ("I", "ignore-glob", "ignore files that match these glob patterns", "GLOB1|GLOB2...");
// Long view options // Long view options
opts.optflag("b", "binary", "use binary prefixes in file sizes"); opts.optflag("b", "binary", "list file sizes with binary prefixes");
opts.optflag("B", "bytes", "list file sizes in bytes, without prefixes"); opts.optflag("B", "bytes", "list file sizes in bytes, without prefixes");
opts.optflag("g", "group", "show group as well as user"); opts.optflag("g", "group", "list each file's group");
opts.optflag("h", "header", "show a header row at the top"); opts.optflag("h", "header", "add a header row to each column");
opts.optflag("H", "links", "show number of hard links"); opts.optflag("H", "links", "list each file's number of hard links");
opts.optflag("i", "inode", "show each file's inode number"); opts.optflag("i", "inode", "list each file's inode number");
opts.optopt ("L", "level", "maximum depth of recursion", "DEPTH"); opts.optflag("m", "modified", "use the modified timestamp field");
opts.optflag("m", "modified", "display timestamp of most recent modification"); opts.optflag("S", "blocks", "list each file's number of file system blocks");
opts.optflag("S", "blocks", "show number of file system blocks"); opts.optopt ("t", "time", "which timestamp field to show", "WORD");
opts.optopt ("t", "time", "which timestamp to show for a file", "WORD"); opts.optflag("u", "accessed", "use the accessed timestamp field");
opts.optflag("u", "accessed", "display timestamp of last access for a file"); opts.optflag("U", "created", "use the created timestamp field");
opts.optflag("U", "created", "display timestamp of creation for a file");
if cfg!(feature="git") { if cfg!(feature="git") {
opts.optflag("", "git", "show git status"); opts.optflag("", "git", "list each file's git status");
} }
if xattr::ENABLED { if xattr::ENABLED {
opts.optflag("@", "extended", "display extended attribute keys and sizes"); opts.optflag("@", "extended", "list each file's extended attribute keys and sizes");
} }
let matches = match opts.parse(args) { let matches = match opts.parse(args) {