Fix completions/ls.fish (#8249)

* Fix ls.fish: add -l option to GNU ls

* Sort alphabetically and remove --lcontext and --scontext (what are these?) on shared and GNU part.

* Revert --lcontext and --scontext options.
This commit is contained in:
Takumi Kameyama 2021-08-25 02:29:32 +09:00 committed by GitHub
parent 48e4ce2f6d
commit 6bd25ed599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,61 +4,61 @@
# Shared ls switches
set -l uname (uname -s)
complete -c ls -s C -d "Force multi-column output"
test "$uname" != SunOS
and complete -c ls -s S -d "Sort by size"
complete -c ls -s m -d "Comma-separated format, fills across screen"
complete -c ls -s x -d "Multi-column output, horizontally listed"
complete -c ls -s 1 -d "List one entry per line"
complete -c ls -s c -d "Sort by changed time, (-l) show ctime"
complete -c ls -s C -d "Force multi-column output"
complete -c ls -s f -d "Unsorted output, enables -a"
complete -c ls -s t -d "Sort by modification time, most recent first"
complete -c ls -s l -d "Long listing format"
complete -c ls -s m -d "Comma-separated format, fills across screen"
complete -c ls -s t -d "Sort by modified time, most recent first"
complete -c ls -s u -d "Sort by access time, (-l) show atime"
complete -c ls -s x -d "Multi-column output, horizontally listed"
complete -c ls -s c -d "Sort (-t) by modified time and show time (-l)"
complete -c ls -s u -d "Sort (-t) by access time and show time (-l)"
# Test if we are using GNU ls
if ls --version >/dev/null 2>/dev/null
complete -c ls -s k -d "Set blocksize to 1kB" # BSD ls -k enables blocksize *output*
complete -c ls -s a -l all -d "Show hidden"
complete -c ls -s A -l almost-all -d "Show hidden except . and .."
complete -c ls -s F -l classify -d "Append filetype indicator (*/=>@|)"
complete -c ls -s H -l dereference-command-line -d "Follow symlinks"
complete -c ls -s L -l dereference -d "Follow symlinks"
complete -c ls -s R -l recursive -d "List subdirectory recursively"
complete -c ls -s b -l escape -d "Octal escapes for non-graphic characters"
complete -c ls -s d -l directory -d "List directories, not their content"
complete -c ls -s F -l classify -d "Append filetype indicator (*/=>@|)"
complete -c ls -s h -l human-readable -d "Human readable sizes"
complete -c ls -s H -l dereference-command-line -d "Follow symlinks"
complete -c ls -s i -l inode -d "Print inode number of files"
complete -c ls -s k -d "Set blocksize to 1kB" # BSD ls -k enables blocksize *output*
complete -c ls -s L -l dereference -d "Follow symlinks"
complete -c ls -s n -l numeric-uid-gid -d "Long format, numeric UIDs and GIDs"
complete -c ls -s p -l file-type -d "Append filetype indicator"
complete -c ls -s q -l hide-control-chars -d "Replace non-graphic characters with '?'"
complete -c ls -s r -l reverse -d "Reverse sort order"
complete -c ls -s R -l recursive -d "List subdirectory recursively"
complete -c ls -s s -l size -d "Print size of files"
# GNU specific ls switches
complete -c ls -l group-directories-first -d "Group directories before files" -r
complete -c ls -l hide -d "Do not list implied entries matching specified shell pattern" -r
complete -c ls -l lcontext -d "Display security context"
complete -c ls -l context -s Z -d "Display security context so it fits on most displays"
complete -c ls -l scontext -d "Display only security context and file name"
complete -c ls -l author -d "Print author"
complete -c ls -l block-size -x -d "Set block size"
complete -c ls -s B -l ignore-backups -d "Ignore files ending with ~"
complete -c ls -l block-size -x -d "Set block size"
complete -c ls -l color -f -a "never always auto" -d "Use colors"
complete -c ls -s D -l dired -d "Generate dired output"
complete -c ls -l dereference-command-line-symlink-to-dir #-d "Follow directory symlinks from command line"
complete -c ls -l format -x -a "across commas horizontal long single-column verbose vertical" -d "List format"
complete -c ls -l full-time -d "Long format, full-iso time"
complete -c ls -s G -l no-group -d "Don't print group information"
complete -c ls -l si -d "Human readable sizes, powers of 1000"
complete -c ls -l dereference-command-line-symlink-to-dir #-d "Follow directory symlinks from command line"
complete -c ls -l indicator-style -x -a "none classify file-type" -d "Append filetype indicator"
complete -c ls -l group-directories-first -r -d "Group directories before files"
complete -c ls -l hide -r -d "Do not list implied entries matching specified shell pattern"
complete -c ls -s I -l ignore -r -d "Skip entries matching pattern"
complete -c ls -l indicator-style -x -a "none classify file-type" -d "Append filetype indicator"
complete -c ls -l lcontext -d "Display security context"
complete -c ls -s N -l literal -d "Print raw entry names"
complete -c ls -s o -d "Long format without groups"
complete -c ls -l show-control-chars -d "Non-graphic characters printed as-is"
complete -c ls -s Q -l quote-name -d "Enclose entry in quotes"
complete -c ls -l quoting-style -x -a "literal locale shell shell-always c escape" -d "Select quoting style"
complete -c ls -l scontext -d "Display only security context and file name"
complete -c ls -l si -d "Human readable sizes, powers of 1000"
complete -c ls -l show-control-chars -d "Non-graphic characters printed as-is"
complete -c ls -l sort -x -d "Sort criteria" -a "
extension\t'Sort by file extension'
none\tDon\'t\ sort
@ -70,6 +70,7 @@ if ls --version >/dev/null 2>/dev/null
access\t'Sort by access time'
use\t'Sort by access time'
"
complete -c ls -s T -l tabsize -x -a "1 2 3 4 5 6 7 8 9 10 11 12" -d "Assume tab stops at each COLS"
complete -c ls -l time -x -d "Show time type" -a "
time\t'Sort by modification time'
access\t'Sort by access time'
@ -78,13 +79,14 @@ if ls --version >/dev/null 2>/dev/null
status\t'Sort by status time'
"
complete -c ls -l time-style -x -a "full-iso long-iso iso locale" -d "Select time style"
complete -c ls -s T -l tabsize -x -a "1 2 3 4 5 6 7 8 9 10 11 12" -d "Assume tab stops at each COLS"
complete -c ls -s U -d "Do not sort"
complete -c ls -s v -d "Sort by version"
complete -c ls -s w -l width -x -d "Assume screen width"
complete -c ls -s X -d "Sort by extension"
complete -c ls -s Z -l context -d "Display security context so it fits on most displays"
complete -c ls -l help -d "Display help and exit"
complete -c ls -l version -d "Display version and exit"
else
#### ls on eunichs ####
# From latest checked-in man pages as of Nov 2018.
@ -113,7 +115,6 @@ else
complete -c ls -s s -d "Show file sizes"
complete -c ls -s g -d "Show group instead of owner in long format"
complete -c ls -s l -d "Long listing format"
complete -c ls -s n -d "Long format, numerical UIDs and GIDs"
contains "$uname" FreeBSD NetBSD OpenBSD DragonFly
and complete -c ls -o o -d "Long format, show file flags" # annoying BSD