Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: buggy configure completion - when both --enable-foo and --disable-foo are listed



Vincent Lefevre wrote on Wed, Aug 31, 2016 at 01:23:32 +0200:
> And there is an inconsistency:
> 
> zira:~/software/mpfr> ./configure --enable-log[Tab]
> 
> gives
> 
> ./configure --enable-logging []
> 
> where [] is the cursor. But
> 
> zira:~/software/mpfr> ./configure --enable-gmp-int[Tab]
> 
> gives:
> 
> zira:~/software/mpfr> ./configure --enable-gmp-internals=[]
> 
> and
> 
> zira:~/software/mpfr> ./configure --enable-gmp-internals --[Tab]
> 
> gives:
> 
> zira:~/software/mpfr> ./configure --enable-gmp-internals --[]
> Completing --enable-gmp-internals
> 
> instead of completing a new option.

It thinks --enable-gmp-internals takes an argument.  This seems to
happen whenever there's an "=" sign on that line of the --help output.

From the trace output:

+_arguments:143> lopts+=( '--enable-foo:enable fo=o' ) 
⋮
+_arguments:266> tmpo=( '--enable-foo:enable fo=o' '--disable-foo:enable fo=o' ) 
+_arguments:267> ((  2  ))
+_arguments:268> tmp=( ) 
+_arguments:270> opt=--enable-foo:enable fo=o
+_arguments:271> [[ '--enable-foo:enable fo=o' == (#b)(*):([^:]#) ]]
+_arguments:272> opt=--enable-foo 
+_arguments:273> odescr='[enable fo=o]' 
+_arguments:277> opt2='--enable-foo=[enable fo=o]' 

Line 143 is in the handling of "--help" parsing.  The other lines look
for --foo=[…]:… specs.  The pattern in 266/268 appears to match the
'=' sign even though it's in the second colon-separated field, where it
doesn't denote a mandatory argument.

I'm guessing the pattern match on lines 266/268 should be fixed, but I'm
not sure how.

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author