Added OS X completions for open, and seq. Added missing stdout redirection to /dev/null when checking command's version.

This commit is contained in:
lordlycastle 2015-12-10 14:20:46 +00:00
parent 3868203c76
commit 96b3e1ce1b
8 changed files with 33 additions and 12 deletions

View file

@ -1,4 +1,4 @@
if cat --version ^ /dev/null # GNU
if cat --version ^ /dev/null > /dev/null # GNU
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 e --description "Escape non-printing characters except tab"

View file

@ -1,4 +1,4 @@
if cp --version ^ /dev/null # GNU
if cp --version ^ /dev/null > /dev/null # GNU
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 -l copy-contents --description "Copy contents of special files when recursive"

View file

@ -6,6 +6,6 @@ if head --version >/dev/null ^/dev/null
complete -f -c head -l version -d 'Display version'
complete -f -c head -l help -d 'Display help'
else # OSX and similar - no longopts (and fewer shortopts)
complete -c head -s c -d 'Print the first N bytes; Leading '-', truncate the last N bytes' -r
complete -c head -s n -d 'Print the first N lines; Leading '-', truncate the last N lines' -r
complete -c head -s c -d 'Print the first N bytes' -r
complete -c head -s n -d 'Print the first N lines' -r
end

View file

@ -0,0 +1,14 @@
if test (uname) = 'Darwin' # OS X
complete -c open -s a -d 'Open APP, or open FILE(s), if supplied, with APP' -x -a "(mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /Developer/Applications 'kMDItemKind==Application' | sed -E 's/.+\/(.+)\.app/\1/g')"
complete -c open -s b -d 'Bundle Identifier of APP to open, or to be used to open FILE' -x -a "(mdls (mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /Developer/Applications 'kMDItemKind==Application') -name kMDItemCFBundleIdentifier | sed -E 's/kMDItemCFBundleIdentifier = \"(.+)\"/\1/g')"
complete -c open -s e -d 'Open FILE(s) with /Applications/TextEdit'
complete -c open -s t -d 'Open FILE(s) with default text editor from LaunchServices'
complete -c open -s f -d 'Open STDIN/PIPE with default text editor. End input with C-d.'
complete -c open -s F -d 'Don\'t restore previous application windows. Except Untitled documents.'
complete -c open -s W -d 'Wait until APP has exited'
complete -c open -s R -d 'Reveal FILE(s) in Finder'
complete -c open -s n -d 'Open new instace of APP'
complete -c open -s g -d 'Open in background'
complete -c open -s h -d 'Finds and opens for a header whose name matches the given string. Better performance with full names i.e. NSView.h' -r
complete -c open -l args -d 'Pass arguments to opened APP in the argv parameter to main()' -x
end

View file

@ -1,6 +1,12 @@
complete -c seq -s f -l format -d 'Use printf style floating-point FORMAT'
complete -c seq -s s -l separator -d 'Use STRING to separate numbers'
complete -c seq -s w -l equal-width -d 'Equalize width with leading zeroes'
complete -c seq -l help -d 'Display this help'
complete -c seq -l version -d 'Output version information'
if seq --version ^ /dev/null > /dev/null #GNU
complete -c seq -s f -l format -d 'Use printf style floating-point FORMAT'
complete -c seq -s s -l separator -d 'Use STRING to separate numbers'
complete -c seq -s w -l equal-width -d 'Equalize width with leading zeroes'
complete -c seq -l help -d 'Display this help'
complete -c seq -l version -d 'Output version information'
else #OS X
complete -c seq -s f -d 'Use printf style floating-point FORMAT'
complete -c seq -s s -d 'Use STRING to separate numbers'
complete -c seq -s w -d 'Equalize width with leading zeroes'
complete -c seq -s t -d 'Use STRING to terminate sequence of numbers'
end

View file

@ -1,4 +1,4 @@
if stat --version ^ /dev/null # GNU
if stat --version ^ /dev/null > /dev/null # GNU
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 c -l format -x -d 'use the specified FORMAT instead of the default; output a newline after each use of FORMAT'

View file

@ -12,6 +12,7 @@ if tail --version > /dev/null ^ /dev/null
complete -c tail -l help -d 'display this help and exit'
complete -c tail -l version -d 'output version information and exit'
else # OSX and similar - no longopts (and fewer shortopts)
complete -c tail -s b -x -d 'output last K 512 byte blocks'
complete -c tail -s c -x -d 'output the last K bytes or only K bytes with -r'
complete -c tail -s f -d 'output appended data as the file grows'
complete -c tail -s F -d 'Like -f, but also follow renamed or rotated files'

View file

@ -1,4 +1,4 @@
if touch --version ^ /dev/null # GNU
if touch --version ^ /dev/null > /dev/null # GNU
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 c -l no-create --description "Do not create file"