Skip to content

Commit 0c5bc26

Browse files
committed
fix: don't build the profile list if "-P" is not invoked before
1 parent e8c677e commit 0c5bc26

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
@@ -190,20 +190,19 @@ _mvn()
190190
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"
191191

192192
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' '|' `
193-
194-
local profiles="${profile_settings}|"
195-
for item in ${POM_HIERARCHY[*]}
196-
do
197-
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' '|' `
198-
local profiles="${profiles}|${profile_pom}"
199-
done
200193

201194
local IFS=$'|\n'
202195

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

206199
elif [[ ${prev} == -P ]] ; then
200+
local profiles="${profile_settings}|"
201+
for item in ${POM_HIERARCHY[*]}
202+
do
203+
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' '|' `
204+
local profiles="${profiles}|${profile_pom}"
205+
done
207206
if [[ ${cur} == *,* ]] ; then
208207
COMPREPLY=( $(compgen -S ',' -W "${profiles}" -P "${cur%,*}," -- ${cur##*,}) )
209208
else

0 commit comments

Comments
 (0)