aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-11-19 21:32:21 +0100
committerGravatar Fabian Homborg <FHomborg@gmail.com>2015-11-19 21:32:21 +0100
commit6336288da18f291e9b209b74ca7245a2bfe4064b (patch)
tree40bb6a7b28b23b0c7c6a6e6c5dce7a79f3a37e53 /share
parent3e0ff6db2a22e95373e5513b9bdfbcef538a5b37 (diff)
Support the OSX versions of head/tail
See #2537. These were written from the online versions of the manpages.
Diffstat (limited to 'share')
-rw-r--r--share/completions/head.fish17
-rw-r--r--share/completions/tail.fish33
2 files changed, 32 insertions, 18 deletions
diff --git a/share/completions/head.fish b/share/completions/head.fish
index 09743994..6aa0f11b 100644
--- a/share/completions/head.fish
+++ b/share/completions/head.fish
@@ -1,6 +1,11 @@
-complete -c head -s c -l bytes -d 'Print the first N bytes; Leading '-', truncate the last N bytes' -r
-complete -c head -s n -l lines -d 'Print the first N lines; Leading '-', truncate the last N lines' -r
-complete -c head -s q -l quiet -l silent -d 'Never print file names'
-complete -c head -s v -l verbose -d 'Always print file names'
-complete -f -c head -l version -d 'Display version'
-complete -f -c head -l help -d 'Display help'
+if head --version >/dev/null ^/dev/null
+ complete -c head -s c -l bytes -d 'Print the first N bytes; Leading '-', truncate the last N bytes' -r
+ complete -c head -s n -l lines -d 'Print the first N lines; Leading '-', truncate the last N lines' -r
+ complete -c head -s q -l quiet -l silent -d 'Never print file names'
+ complete -c head -s v -l verbose -d 'Always print file names'
+ 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
+end
diff --git a/share/completions/tail.fish b/share/completions/tail.fish
index 0c774663..aa67e784 100644
--- a/share/completions/tail.fish
+++ b/share/completions/tail.fish
@@ -1,12 +1,21 @@
-complete -c tail -s c -l bytes -x -d 'output the last K bytes; alternatively, use -c +K to output bytes starting with the Kth of each file'
-complete -c tail -s f -l follow -xa 'name descriptor' -d 'output appended data as the file grows; -f -l follow, and --follow=descriptor are equivalent'
-complete -c tail -s F -d 'same as --follow=name --retry'
-complete -c tail -s n -l lines -x -d 'output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth'
-complete -c tail -l max-unchanged-stats -x -d 'with --follow=name, reopen a FILE which has not changed size after N iterations'
-complete -c tail -l pid -d 'with -f, terminate after process ID, PID dies' -xa '(__fish_complete_pids)'
-complete -c tail -s q -l quiet -l silent -d 'never output headers giving file names'
-complete -c tail -l retry -d 'keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name'
-complete -c tail -s s -l sleep-interval -x -d 'with -f, sleep for approximately N seconds (default 1.0) between iterations'
-complete -c tail -s v -l verbose -d 'always output headers giving file names'
-complete -c tail -l help -d 'display this help and exit'
-complete -c tail -l version -d 'output version information and exit'
+if tail --version > /dev/null ^ /dev/null
+ complete -c tail -s c -l bytes -x -d 'output the last K bytes; alternatively, use -c +K to output bytes starting with the Kth of each file'
+ complete -c tail -s f -l follow -xa 'name descriptor' -d 'output appended data as the file grows; -f -l follow, and --follow=descriptor are equivalent'
+ complete -c tail -s F -d 'same as --follow=name --retry'
+ complete -c tail -s n -l lines -x -d 'output the last K lines, instead of the last 10; or use -n +K to output lines starting with the Kth'
+ complete -c tail -l max-unchanged-stats -x -d 'with --follow=name, reopen a FILE which has not changed size after N iterations'
+ complete -c tail -l pid -d 'with -f, terminate after process ID, PID dies' -xa '(__fish_complete_pids)'
+ complete -c tail -s q -l quiet -l silent -d 'never output headers giving file names'
+ complete -c tail -l retry -d 'keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name'
+ complete -c tail -s s -l sleep-interval -x -d 'with -f, sleep for approximately N seconds (default 1.0) between iterations'
+ complete -c tail -s v -l verbose -d 'always output headers giving file names'
+ 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 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'
+ complete -c tail -s n -x -d 'output the last K lines, instead of the last 10 - or only K lines with -r'
+ complete -c tail -s q -d 'never output headers giving file names'
+ complete -c tail -s r -d 'Display input in reverse order' # Only in OSX
+end