From 540bdfcb026dfadf8d6fc8bde91cddc886b2c677 Mon Sep 17 00:00:00 2001 From: lordlycastle Date: Thu, 10 Mar 2016 15:35:39 +0000 Subject: [PATCH] date and uniq completions for OS X. --- share/completions/date.fish | 33 +++++++++++++++++++++----------- share/completions/uniq.fish | 38 ++++++++++++++++++++++--------------- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/share/completions/date.fish b/share/completions/date.fish index 1c93f2352..b7725f199 100644 --- a/share/completions/date.fish +++ b/share/completions/date.fish @@ -1,11 +1,22 @@ -complete -c date -s d -l date --description "Display date described by string" -x -complete -c date -s f -l file --description "Display date for each line in file" -r -complete -c date -s I -l iso-8601 --description "Output in ISO 8601 format" -x -a "date hours minutes seconds" -complete -c date -s s -l set --description "Set time" -x -complete -c date -s R -l rfc-2822 --description "Output RFC-2822 compliant date string" -complete -c date -s r -l reference --description "Display the last modification time of file" -r -complete -c date -s u -l utc --description "Print or set Coordinated Universal Time" -complete -c date -l universal --description "Print or set Coordinated Universal Time" -complete -c date -s h -l help --description "Display help and exit" -complete -c date -s v -l version --description "Display version and exit" - +if date --version > /dev/null ^ /dev/null + complete -c date -s d -l date --description "Display date described by string" -x + complete -c date -s f -l file --description "Display date for each line in file" -r + complete -c date -s I -l iso-8601 --description "Output in ISO 8601 format" -x -a "date hours minutes seconds" + complete -c date -s s -l set --description "Set time" -x + complete -c date -s R -l rfc-2822 --description "Output RFC-2822 compliant date string" + complete -c date -s r -l reference --description "Display the last modification time of file" -r + complete -c date -s u -l utc --description "Print or set Coordinated Universal Time" + complete -c date -l universal --description "Print or set Coordinated Universal Time" + complete -c date -s h -l help --description "Display help and exit" + complete -c date -s v -l version --description "Display version and exit" +else # OS X + complete -c date -s d -d 'Set the kernel\'s value for daylight saving time' -x + complete -c date -s f -d 'Use format string to parse the date provided rather than default format' + complete -c date -s j -d 'Do no try to set the date' + complete -c date -s n -d 'Set the time for current machine only in the local group' + complete -c date -s r -d 'Print date and time represented by SEC since Epoch' -x + complete -c date -s t -d 'Set system\'s value for MINUTES west of GMT' + complete -c date -s u -d 'Display or set the date int UTC time' + complete -c date -s v -d 'Adjust the time component backward(-)/forward(+) according to VAL' -x +end + diff --git a/share/completions/uniq.fish b/share/completions/uniq.fish index 0027d71fc..1e35c9c59 100644 --- a/share/completions/uniq.fish +++ b/share/completions/uniq.fish @@ -1,15 +1,23 @@ -complete -c uniq -s c -l count --description "Print number of occurences" -complete -c uniq -s d -l repeated --description "Only print duplicates" -complete -c uniq -s D -l all-repeated --description "Remove non-duplicate lines" -f -x -a " - none\t'Remove none-duplicate lines' - prepend\t'Remove non-duplicate lines and print an empty line before each non-duplicate' - separate\t'Remove non-duplicate lines and print an empty line between each non-duplicate' -" -complete -c uniq -s f -l skip-fields --description "Avoid comparing first N fields" -r -complete -c uniq -s i -l ignore-case --description "Case insensitive" -complete -c uniq -s s -l skip-chars --description "Avoid comparing first N characters" -r -complete -c uniq -s u -l unique --description "Only print unique lines" -complete -c uniq -s w -l check-chars --description "Compare only specified number of characters" -r -complete -c uniq -l help --description "Display help and exit" -complete -c uniq -l version --description "Display version and exit" - +if uniq --version > /dev/null ^ /dev/null + complete -c uniq -s c -l count --description "Print number of occurences" + complete -c uniq -s d -l repeated --description "Only print duplicates" + complete -c uniq -s D -l all-repeated --description "Remove non-duplicate lines" -f -x -a " + none\t'Remove none-duplicate lines' + prepend\t'Remove non-duplicate lines and print an empty line before each non-duplicate' + separate\t'Remove non-duplicate lines and print an empty line between each non-duplicate' + " + complete -c uniq -s f -l skip-fields --description "Avoid comparing first N fields" -r + complete -c uniq -s i -l ignore-case --description "Case insensitive" + complete -c uniq -s s -l skip-chars --description "Avoid comparing first N characters" -r + complete -c uniq -s u -l unique --description "Only print unique lines" + complete -c uniq -s w -l check-chars --description "Compare only specified number of characters" -r + complete -c uniq -l help --description "Display help and exit" + complete -c uniq -l version --description "Display version and exit" +else # OS X + complete -c uniq -s c -d 'Precede each output line with count of it\'s occurrence' + complete -c uniq -s d -d 'Only print duplicates' + complete -c uniq -s f -d 'Avoid comparing first N fields' -x + complete -c uniq -s s -d 'Avoid comparing fist N characters' -x + complete -c uniq -s u -d 'Only print unique lines' + complete -c uniq -s i -d 'Case insensitive comparision' +end