Merge pull request #2572 from lordlycastle/master

Added completions for cat, cp, mktemp, stat, touch for OS X.
This commit is contained in:
Fabian Homborg 2015-11-28 14:41:03 +01:00
commit c5bcc4567e
5 changed files with 119 additions and 66 deletions

View file

@ -1,3 +1,4 @@
if cat --version ^ /dev/null # GNU
complete -c cat -s A -l show-all --description "Escape all non-printing characters" complete -c cat -s A -l show-all --description "Escape all non-printing characters"
complete -c cat -s b -l number-nonblank --description "Number nonblank lines" complete -c cat -s b -l number-nonblank --description "Number nonblank lines"
complete -c cat -s e --description "Escape non-printing characters except tab" complete -c cat -s e --description "Escape non-printing characters except tab"
@ -9,4 +10,12 @@ complete -c cat -s T -l show-tabs --description "Escape tab"
complete -c cat -s v --description "Escape non-printing except newline and tab" complete -c cat -s v --description "Escape non-printing except newline and tab"
complete -c cat -l help --description "Display help and exit" complete -c cat -l help --description "Display help and exit"
complete -c cat -l version --description "Display version and exit" complete -c cat -l version --description "Display version and exit"
else # OS X
complete -c cat -s b -d "Number non-blank lines"
complete -c cat -s e -d "Display non-printing characters, and `\$' at the end of each line"
complete -c cat -s n -d "Number all lines"
complete -c cat -s s -d "Single spaced output by squeezing adjacent empty lines"
complete -c cat -s t -d "Display non-printing characters, and tab characters as `^I'"
complete -c cat -s u -d "Disable output buffering"
complete -c cat -s v -d "Display non-printing characters so they're visible."
end

View file

@ -1,4 +1,4 @@
if cp --version ^ /dev/null # GNU
complete -c cp -s a -l archive --description "Same as -dpR" complete -c cp -s a -l archive --description "Same as -dpR"
complete -c cp -s b -l backup --description "Make backup of each existing destination file" -a "none off numbered t existing nil simple never" complete -c cp -s b -l backup --description "Make backup of each existing destination file" -a "none off numbered t existing nil simple never"
complete -c cp -l copy-contents --description "Copy contents of special files when recursive" complete -c cp -l copy-contents --description "Copy contents of special files when recursive"
@ -27,3 +27,16 @@ complete -c cp -s s -l symbolic-link --description "Make symbolic links instead
complete -c cp -s T -l no-target-directory --description "Treat DEST as a normal file" complete -c cp -s T -l no-target-directory --description "Treat DEST as a normal file"
complete -c cp -s x -l one-file-system --description "Stay on this file system" complete -c cp -s x -l one-file-system --description "Stay on this file system"
complete -c cp -s X -l context -r --description "Set security context of copy to CONTEXT" complete -c cp -s X -l context -r --description "Set security context of copy to CONTEXT"
else # OS X
complete -c cp -s a --description "Preserve structure and attributes of files but not directory structure. (-pPR)"
complete -c cp -s f -d "Replace destination file without confirmation"
complete -c cp -s H -d "Follow symlinks on command-link"
complete -c cp -s i -d "Prompt before overwrite"
complete -c cp -s L -d "Follow all symlinks"
complete -c cp -s n -d "Do overwrite existing files"
complete -c cp -s P -d "Don't follow symlinks (default)"
complete -c cp -s p -d "Preserve attributes of source file"
complete -c cp -s R -d "Copy directories recursively"
complete -c cp -s v -d "Verbos output"
complete -c cp -s X -d "Do not copy Extended Attributes (EAs) of resource forks"
end

View file

@ -1,3 +1,4 @@
if mktemp --version >/dev/null ^/dev/null # GNU
complete -c mktemp -s d -l directory -d 'create a directory, not a file' complete -c mktemp -s d -l directory -d 'create a directory, not a file'
complete -c mktemp -s u -l dry-run -d 'do not create anything; merely print a name (unsafe)' complete -c mktemp -s u -l dry-run -d 'do not create anything; merely print a name (unsafe)'
complete -c mktemp -s q -l quiet -d 'suppress diagnostics about file/dir-creation failure' complete -c mktemp -s q -l quiet -d 'suppress diagnostics about file/dir-creation failure'
@ -5,3 +6,9 @@ complete -c mktemp -l suffix -r -d 'append SUFF to TEMPLATE'
complete -c mktemp -l tmpdir -d 'interpret TEMPLATE relative to DIR' complete -c mktemp -l tmpdir -d 'interpret TEMPLATE relative to DIR'
complete -c mktemp -l help -d 'display this help and exit' complete -c mktemp -l help -d 'display this help and exit'
complete -c mktemp -l version -d 'output version information and exit' complete -c mktemp -l version -d 'output version information and exit'
else # OS X
complete -c mktemp -s d -d 'create a directory, not a file'
complete -c mktemp -s q -d 'suppress diagnostics about file/dir-creation failure'
complete -c mktemp -s t -r -d 'generate a template using PREFIX and TMPDIR (if set)'
complete -c mktemp -s u -d 'file will be unliked before mktemp exits (unsafe)'
end

View file

@ -1,3 +1,4 @@
if stat --version ^ /dev/null # GNU
complete -c stat -s L -l dereference -d 'follow links' complete -c stat -s L -l dereference -d 'follow links'
complete -c stat -s f -l file-system -d 'display file system status instead of file status' complete -c stat -s f -l file-system -d 'display file system status instead of file status'
complete -c stat -s c -l format -x -d 'use the specified FORMAT instead of the default; output a newline after each use of FORMAT' complete -c stat -s c -l format -x -d 'use the specified FORMAT instead of the default; output a newline after each use of FORMAT'
@ -5,3 +6,15 @@ complete -c stat -l printf -x -d 'like --format, but interpret backsl
complete -c stat -s t -l terse -d 'print the information in terse form' complete -c stat -s t -l terse -d 'print the information in terse form'
complete -c stat -l help -d 'display this help and exit' complete -c stat -l help -d 'display this help and exit'
complete -c stat -l version -d 'output version information and exit' complete -c stat -l version -d 'output version information and exit'
else # OS X
complete -c stat -s F -d "Display content type symbols similar to ls(1)"
complete -c stat -s f -d "Display information using specified FORMAT" -r
complete -c stat -s L -d "Use stat(2) instead of lsstat(2)"
complete -c stat -s l -d "Display output in ls -lT format"
complete -c stat -s n -d "Don't force a newline to appear at end of each piece of output"
complete -c stat -s q -d "Supress failure messages"
complete -c stat -s r -d "Display raw information"
complete -c stat -s s -d "Display informationin ``shell output'' suitable for initialising variables"
complete -c stat -s t -d "Display timestamps using specified FORMAT" -r
complete -c stat -s x -d "Verbose information, similar to some Linux distributions"
end

View file

@ -1,3 +1,4 @@
if touch --version ^ /dev/null # GNU
complete -c touch -s a --description "Change access time" complete -c touch -s a --description "Change access time"
complete -c touch -s B -l backward -x --description "Set date back" complete -c touch -s B -l backward -x --description "Set date back"
complete -c touch -s c -l no-create --description "Do not create file" complete -c touch -s c -l no-create --description "Do not create file"
@ -9,3 +10,13 @@ complete -c touch -s t --description "Set date"
complete -c touch -l time -x --description "Set time" complete -c touch -l time -x --description "Set time"
complete -c touch -l help --description "Display help and exit" complete -c touch -l help --description "Display help and exit"
complete -c touch -l version --description "Display version and exit" complete -c touch -l version --description "Display version and exit"
else # OS X
complete -c touch -s A -d "Adjust access and modification time stamps by specified VALUE" -r
complete -c touch -s a -d "Change access time of file"
complete -c touch -s c -d "Don't create file if it doesn't exist"
complete -c touch -s f -d "Attempt to force the update, even when permission don't permit"
complete -c touch -s h -d "Change times of the symlink ranther than the file. Implies `-c'"
complete -c touch -s m -d "Change modification time of file"
complete -c touch -s r -d "Use access and modifications times from specified file rather than current time of day"
complete -c touch -s t -d "Change access and modifications times to specified file rather than current time of day"
end