Added completions for cat, cp, mktemp, stat, touch for OS X.

This commit is contained in:
lordlycastle 2015-11-28 00:35:26 +00:00
parent 53fc9a4002
commit 3868203c76
5 changed files with 119 additions and 66 deletions

View file

@ -1,12 +1,21 @@
complete -c cat -s A -l show-all --description "Escape all non-printing characters" if cat --version ^ /dev/null # GNU
complete -c cat -s b -l number-nonblank --description "Number nonblank lines" complete -c cat -s A -l show-all --description "Escape all non-printing characters"
complete -c cat -s e --description "Escape non-printing characters except tab" complete -c cat -s b -l number-nonblank --description "Number nonblank lines"
complete -c cat -s E -l show-ends --description "Display \$ at end of line" complete -c cat -s e --description "Escape non-printing characters except tab"
complete -c cat -s n -l number --description "Number all lines" complete -c cat -s E -l show-ends --description "Display \$ at end of line"
complete -c cat -s s -l squeeze-blank --description "Never more than single blank line" complete -c cat -s n -l number --description "Number all lines"
complete -c cat -s t --description "Escape non-printing characters except newline" complete -c cat -s s -l squeeze-blank --description "Never more than single blank line"
complete -c cat -s T -l show-tabs --description "Escape tab" complete -c cat -s t --description "Escape non-printing characters except newline"
complete -c cat -s v --description "Escape non-printing except newline and tab" complete -c cat -s T -l show-tabs --description "Escape tab"
complete -c cat -l help --description "Display help and exit" complete -c cat -s v --description "Escape non-printing except newline and tab"
complete -c cat -l version --description "Display version and exit" complete -c cat -l help --description "Display help 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,29 +1,42 @@
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"
complete -c cp -s d --description "Same as --no-dereference --preserve=link" complete -c cp -s d --description "Same as --no-dereference --preserve=link"
complete -c cp -s f -l force --description "Do not prompt before overwriting" complete -c cp -s f -l force --description "Do not prompt before overwriting"
complete -c cp -s i -l interactive --description "Prompt before overwrite" complete -c cp -s i -l interactive --description "Prompt before overwrite"
complete -c cp -s H --description "Follow command-line symbolic links" complete -c cp -s H --description "Follow command-line symbolic links"
complete -c cp -s l -l link --description "Link files instead of copying" complete -c cp -s l -l link --description "Link files instead of copying"
complete -c cp -l strip-trailing-slashes --description "Remove trailing slashes from source" complete -c cp -l strip-trailing-slashes --description "Remove trailing slashes from source"
complete -c cp -s S -l suffix -r --description "Backup suffix" complete -c cp -s S -l suffix -r --description "Backup suffix"
complete -c cp -s t -l target-directory --description "Target directory" -x -a "(__fish_complete_directories (commandline -ct) 'Target directory')" complete -c cp -s t -l target-directory --description "Target directory" -x -a "(__fish_complete_directories (commandline -ct) 'Target directory')"
complete -c cp -s u -l update --description "Do not overwrite newer files" complete -c cp -s u -l update --description "Do not overwrite newer files"
complete -c cp -s v -l verbose --description "Verbose mode" complete -c cp -s v -l verbose --description "Verbose mode"
complete -c cp -l help --description "Display help and exit" complete -c cp -l help --description "Display help and exit"
complete -c cp -l version --description "Display version and exit" complete -c cp -l version --description "Display version and exit"
complete -c cp -s L -l dereference --description "Always follow symbolic links" complete -c cp -s L -l dereference --description "Always follow symbolic links"
complete -c cp -s P -l no-dereference --description "Never follow symbolic links" complete -c cp -s P -l no-dereference --description "Never follow symbolic links"
complete -c cp -s p --description "Same as --preserve=mode,ownership,timestamps" complete -c cp -s p --description "Same as --preserve=mode,ownership,timestamps"
complete -c cp -f -l preserve --description "Preserve ATTRIBUTES if possible" -xa "mode ownership timestamps links all" complete -c cp -f -l preserve --description "Preserve ATTRIBUTES if possible" -xa "mode ownership timestamps links all"
complete -c cp -f -l no-preserve -r --description "Don't preserve ATTRIBUTES" -xa "mode ownership timestamps links all" complete -c cp -f -l no-preserve -r --description "Don't preserve ATTRIBUTES" -xa "mode ownership timestamps links all"
complete -c cp -l parents --description "Use full source file name under DIRECTORY" complete -c cp -l parents --description "Use full source file name under DIRECTORY"
complete -c cp -s r -s R -l recursive --description "Copy directories recursively" complete -c cp -s r -s R -l recursive --description "Copy directories recursively"
complete -c cp -l remove-destination --description "First remove existing destination files" complete -c cp -l remove-destination --description "First remove existing destination files"
complete -c cp -f -l sparse -r --description "Control creation of sparse files" -xa "always auto never" complete -c cp -f -l sparse -r --description "Control creation of sparse files" -xa "always auto never"
complete -c cp -s s -l symbolic-link --description "Make symbolic links instead of copying" complete -c cp -s s -l symbolic-link --description "Make symbolic links instead of copying"
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,7 +1,14 @@
complete -c mktemp -s d -l directory -d 'create a directory, not a file' if mktemp --version >/dev/null ^/dev/null # GNU
complete -c mktemp -s u -l dry-run -d 'do not create anything; merely print a name (unsafe)' complete -c mktemp -s d -l directory -d 'create a directory, not a file'
complete -c mktemp -s q -l quiet -d 'suppress diagnostics about file/dir-creation failure' complete -c mktemp -s u -l dry-run -d 'do not create anything; merely print a name (unsafe)'
complete -c mktemp -l suffix -r -d 'append SUFF to TEMPLATE' complete -c mktemp -s q -l quiet -d 'suppress diagnostics about file/dir-creation failure'
complete -c mktemp -l tmpdir -d 'interpret TEMPLATE relative to DIR' complete -c mktemp -l suffix -r -d 'append SUFF to TEMPLATE'
complete -c mktemp -l help -d 'display this help and exit' complete -c mktemp -l tmpdir -d 'interpret TEMPLATE relative to DIR'
complete -c mktemp -l version -d 'output version information and exit' complete -c mktemp -l help -d 'display this help 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,7 +1,20 @@
complete -c stat -s L -l dereference -d 'follow links' if stat --version ^ /dev/null # GNU
complete -c stat -s f -l file-system -d 'display file system status instead of file status' complete -c stat -s L -l dereference -d 'follow links'
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 f -l file-system -d 'display file system status instead of file status'
complete -c stat -l printf -x -d 'like --format, but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include \n in 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'
complete -c stat -s t -l terse -d 'print the information in terse form' complete -c stat -l printf -x -d 'like --format, but interpret backslash escapes, and do not output a mandatory trailing newline. If you want a newline, include \n in FORMAT'
complete -c stat -l help -d 'display this help and exit' complete -c stat -s t -l terse -d 'print the information in terse form'
complete -c stat -l version -d 'output version information and exit' complete -c stat -l help -d 'display this help 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,11 +1,22 @@
complete -c touch -s a --description "Change access time" if touch --version ^ /dev/null # GNU
complete -c touch -s B -l backward -x --description "Set date back" complete -c touch -s a --description "Change access time"
complete -c touch -s c -l no-create --description "Do not create file" complete -c touch -s B -l backward -x --description "Set date back"
complete -c touch -s d -l date -x --description "Set date" complete -c touch -s c -l no-create --description "Do not create file"
complete -c touch -s f -l forward -x --description "Set date forward" complete -c touch -s d -l date -x --description "Set date"
complete -c touch -s m --description "Change modification time" complete -c touch -s f -l forward -x --description "Set date forward"
complete -c touch -s r -l reference --description "Use this files times" complete -c touch -s m --description "Change modification time"
complete -c touch -s t --description "Set date" complete -c touch -s r -l reference --description "Use this files times"
complete -c touch -l time -x --description "Set time" complete -c touch -s t --description "Set date"
complete -c touch -l help --description "Display help and exit" complete -c touch -l time -x --description "Set time"
complete -c touch -l version --description "Display version and exit" complete -c touch -l help --description "Display help 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