Skip to content

Commit 0570084

Browse files
committed
fix: don't build the profile list if "-P" is not invoked before
1 parent 19f706a commit 0570084

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

bash_completion.bash

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,19 @@ _mvn()
192192
local options="-Dmaven.test.skip=true|-DskipTests|-DskipITs|-Dtest|-Dit.test|-DfailIfNoTests|-Dmaven.surefire.debug|-DenableCiProfile|-Dpmd.skip=true|-Dcheckstyle.skip=true|-Dtycho.mode=maven|-Dmaven.javadoc.skip=true|-Dgwt.compiler.skip|-Dcobertura.skip=true|-Dfindbugs.skip=true||-DperformRelease=true|-Dgpg.skip=true|-DforkCount"
193193

194194
local profile_settings=`[ -e ~/.m2/settings.xml ] && \grep -e "<profile>" -A 1 ~/.m2/settings.xml | \grep -e "<id>.*</id>" | sed -e 's/.*<id>//' -e 's/<\/id>.*//g' | tr '\n' '|' `
195-
196-
local profiles="${profile_settings}|"
197-
for item in ${POM_HIERARCHY[*]}
198-
do
199-
local profile_pom=`[ -e $item ] && \grep -e "<profile>" -A 1 $item | \grep -e "<id>.*</id>" | sed -e 's/.*<id>//' -e 's/<\/id>.*//g' | tr '\n' '|' `
200-
local profiles="${profiles}|${profile_pom}"
201-
done
202195

203196
local IFS=$'|\n'
204197

205198
if [[ ${cur} == -D* ]] ; then
206199
COMPREPLY=( $(compgen -S ' ' -W "${options}" -- ${cur}) )
207200

208201
elif [[ ${prev} == -P ]] ; then
202+
local profiles="${profile_settings}|"
203+
for item in ${POM_HIERARCHY[*]}
204+
do
205+
local profile_pom=`[ -e $item ] && \grep -e "<profile>" -A 1 $item | \grep -e "<id>.*</id>" | sed -e 's/.*<id>//' -e 's/<\/id>.*//g' | tr '\n' '|' `
206+
local profiles="${profiles}|${profile_pom}"
207+
done
209208
if [[ ${cur} == *,* ]] ; then
210209
COMPREPLY=( $(compgen -S ',' -W "${profiles}" -P "${cur%,*}," -- ${cur##*,}) )
211210
else

0 commit comments

Comments
 (0)