about summary refs log tree commit diff
path: root/Completion/User/_configure
blob: 050701fac809cbc67e8255b9fb3882e086945100 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#defcomp configure

setopt localoptions extendedglob

if [[ $PREFIX = *=* ]]; then
  # Complete filenames after e.g. --prefix=
  IPREFIX=${PREFIX%%=*}=
  PREFIX=${PREFIX#*=}
  compgen -f
else
  # Generate a list of options from configure --help
  local -a pars
  local i
  pars=($($words[1] --help | awk '$1 ~ /--[a-z]*.*/ {print $1}'))
  for i in $pars
  do
    case $i in
      (--(((en|dis)able-FEATURE)|(with(out|)-PACKAGE))*)
        : Skip standard help output
      ;;
      --enable)
        : Skip standard help output
      ;;
      --*\[=* )
        compadd -M 'r:|-=* r:|=*' -q -S = -- ${i%%\[=*}
      ;;
      --*=* )
        compadd -M 'r:|-=* r:|=*' -S = -- ${i%%=*}
      ;;
      * )
        compadd -M 'r:|-=* r:|=*' -- $i
      ;;
    esac
  done
fi