summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-08-19 12:12:46 -0500
committerAndrew Gallant <jamslam@gmail.com>2018-08-20 07:50:00 -0400
commit3a1c081c136a222ddbd03d79c719af0583e09d89 (patch)
tree2ffe92461f1224a58e61e956c314e746a92ed52f
parentd5c0b0303002087504e956706c323073a1b09a2b (diff)
test_complete: match certain long options in description bodies
-rwxr-xr-xci/test_complete.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/ci/test_complete.sh b/ci/test_complete.sh
index b178e851..985ef11b 100755
--- a/ci/test_complete.sh
+++ b/ci/test_complete.sh
@@ -39,12 +39,14 @@ main() {
print -rl - 'Comparing options:' "-$rg" "+$_rg"
# 'Parse' options out of the `--help` output. To prevent false positives we
- # only look at lines where the first non-white-space character is `-`
+ # only look at lines where the first non-white-space character is `-`, or
+ # where a long option starting with certain letters (see `_rg`) is found.
+ # Occasionally we may have to handle some manually, however
help_args=( ${(f)"$(
$rg --help |
- $rg -- '^\s*-' |
- $rg -io -- '[\t ,](-[a-z0-9]|--[a-z0-9-]+)\b' |
- tr -d '\t ,' |
+ $rg -i -- '^\s+--?[a-z0-9]|--[imnp]' |
+ $rg -ior '$1' -- $'[\t /\"\'`.,](-[a-z0-9]|--[a-z0-9-]+)\\b' |
+ $rg -v -- --print0 | # False positives
sort -u
)"} )
@@ -58,8 +60,6 @@ main() {
comp_args=( ${comp_args%%-[:[]*} ) # Strip everything after -optname-
comp_args=( ${comp_args%%[:+=[]*} ) # Strip everything after other optspecs
comp_args=( ${comp_args##[^-]*} ) # Remove non-options
-
- # This probably isn't necessary, but we should ensure the same order
comp_args=( ${(f)"$( print -rl - $comp_args | sort -u )"} )
(( $#help_args )) || {