aboutsummaryrefslogtreecommitdiff
blob: e292e6c38728e299d5d37ca914110e7fb1fb1d85 (plain)
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
#compdef gcc-config
# gcc-config-1.8

local arguments

arguments=(
  {'(--nocolor)-C','(-C)--nocolor'}'[disable colored output]'
  '(- :)'{--use-old,-O}'[use the old profile if one was selected]'
  {'(--force)-f','(-f)--force'}'[make sure all config files are regenerated]'
  '(- :)'{--get-current-profile,-c}'[print current used gcc profile]'
  '(- :)'{--list-profiles,-l}'[print a list of available profiles]'
  {'(--split-profile)-S','(-S)--split-profile'}'[split profiles into their components]'
  '(- :)'{--print-environ,-E}'[print environment of the given/current profile]:profiles:_gcc_profiles'
  '(- :)'{--get-bin-path,-B}'[print binary path of given/current profile]:profiles:_gcc_profiles'
  '(- :)'{--get-lib-path,-L}'[print library path of given/current profile]:profiles:_gcc_profiles'
  '(- :)'{--help,-h}'[show help]'
  '(- :):profiles:_gcc_profiles'
)

_gcc_profiles(){
  local profiles
  profiles=(${(f)"$(_call_program gcc-installed RC_NOCOLOR=yes gcc-config --list-profiles)"})
  profiles=${${profiles/\[([^]]*)\]/}/\*}
  _tags profiles && { compadd "$@" -k profiles || compadd "$@" ${(kv)=profiles} }
}

_arguments $arguments

# vim: set et sw=2 ts=2 ft=zsh: