aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/head.fish
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/completions/head.fish
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/completions/head.fish')
-rw-r--r--share/completions/head.fish17
1 files changed, 11 insertions, 6 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