aboutsummaryrefslogtreecommitdiff
blob: e4dfb51f91be939ccbab8f875d792bf055a8f4b4 (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}'[disable colored output]'
  '(- :)'{--use-old,-O}'[use the old profile if one was selected]'
  '(- :)'{--force,-f}'[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}'[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: