From 8c431f76ea1d14c264df5a1c8d84bddd1da0a5a0 Mon Sep 17 00:00:00 2001 From: Robert Siska Date: Tue, 5 Aug 2014 17:04:00 +0200 Subject: [PATCH 1/3] Added completion for _nl --- src/_nl | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/_nl diff --git a/src/_nl b/src/_nl new file mode 100644 index 0000000..6f04693 --- /dev/null +++ b/src/_nl @@ -0,0 +1,54 @@ +#compdef nl +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for GNU nl (coreutils 8.13). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * github.com/RobSis +# +# ------------------------------------------------------------------------------ + +local arguments style_values format_values ret=1 + +style_values=( + "a:number all lines" + "t:number only nonempty lines" + "n:number no lines" + "pBRE:number only lines that contain a match for the basic regular expresision, BRE" +) + +format_values=( + "ln:left justified, no leading zeros" + "rn:right justified, no leading zeros" + "rz:right justified, leading zeros" +) + +_arguments -C -s -S \ + {-b+,--body-numbering=}'[use STYLE for \[numbering body\] lines]:style:->style' \ + {-d+,--section-delimiter=}'[use CC for separating logical pages]' \ + {-f+,--footer-numbering=}'[use STYLE for numbering footer lines]:style:->style' \ + {-h+,--header-numbering=}'[use STYLE for numbering header lines]:style:->style' \ + {-i+,--line-increment=}'[line number increment at each line]' \ + {-l+,--join-blank-lines=}'[group of NUMBER empty lines counted as one]' \ + {-n+,--number-format=}'[insert line numbers according to FORMAT]:format:->format' \ + {-p,--no-renumber}'[do not reset line numbers at logical pages]' \ + {-s+,--number-separator=}'[add STRING after (possible) line number]' \ + {-v+,--starting-line-number=}'[first line number on each logical page]' \ + {-w+,--number-width=}'[use NUMBER columns for line numbers]' \ + --help'[display help and exit]' \ + --version'[output version information and exit]' \ + '*:filename:_files' && ret=0 + +case "$state" in + (style) + _describe -t style style style_values && ret=0 + ;; + (format) + _describe -t format format format_values && ret=0 + ;; +esac From b917aff9357e806ac72096b4b876613c3395df4c Mon Sep 17 00:00:00 2001 From: Robert Siska Date: Tue, 5 Aug 2014 17:07:09 +0200 Subject: [PATCH 2/3] Added return statement --- src/_nl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_nl b/src/_nl index 6f04693..bd6bfa2 100644 --- a/src/_nl +++ b/src/_nl @@ -52,3 +52,5 @@ case "$state" in _describe -t format format format_values && ret=0 ;; esac + +return $ret From ee85a0ad7231502bfb8f8b3768542edf0d80b627 Mon Sep 17 00:00:00 2001 From: Robert Siska Date: Thu, 21 Aug 2014 18:00:04 +0200 Subject: [PATCH 3/3] Removed uncessesary brackes --- src/_nl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_nl b/src/_nl index bd6bfa2..bd8e66c 100644 --- a/src/_nl +++ b/src/_nl @@ -29,7 +29,7 @@ format_values=( ) _arguments -C -s -S \ - {-b+,--body-numbering=}'[use STYLE for \[numbering body\] lines]:style:->style' \ + {-b+,--body-numbering=}'[use STYLE for given number of lines]:style:->style' \ {-d+,--section-delimiter=}'[use CC for separating logical pages]' \ {-f+,--footer-numbering=}'[use STYLE for numbering footer lines]:style:->style' \ {-h+,--header-numbering=}'[use STYLE for numbering header lines]:style:->style' \