Skip to content

Commit d5dada1

Browse files
committed
fix: sed + profile (continuation)
1 parent 67eac47 commit d5dada1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bash_completion.bash

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,29 @@ _mvn()
187187
local plugin_goals_wildfly="wildfly:add-resource|wildfly:deploy|wildfly:deploy-only|wildfly:deploy-artifact|wildfly:redeploy|wildfly:redeploy-only|wildfly:undeploy|wildfly:undeploy-artifact|wildfly:run|wildfly:start|wildfly:shutdown|wildfly:execute-commands"
188188

189189
## some plugin (like jboss-as) has '-' which is not allowed in shell var name, to use '_' then replace
190-
local common_plugins=`compgen -v | \grep "^plugin_goals_.*" | sed -e 's/plugin_goals_//g' -e 's/_/-/g' | tr '\n' '|'`
190+
local common_plugins=`compgen -v | \grep "^plugin_goals_.*" | sed -e 's/plugin_goals_//g' -e 's/_/-/g' -e 's@\n@|@g'`
191191

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

194-
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-
194+
local OIFS=$IFS
196195
local IFS=$'|\n'
197196

198197
if [[ ${cur} == -D* ]] ; then
199198
COMPREPLY=( $(compgen -S ' ' -W "${options}" -- ${cur}) )
200199

201200
elif [[ ${prev} == -P || ${prev} == --activate-profiles ]] ; then
201+
IFS=$OIFS
202+
203+
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' -e 's@\n@|@g' `
202204
local profiles="${profile_settings}|"
203205
for item in ${POM_HIERARCHY[*]}
204206
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' '|' `
207+
local profile_pom=`[ -e $item ] && \grep -e "<profile>" -A 1 $item | \grep -e "<id>.*</id>" | sed -e 's/.*<id>//' -e 's/<\/id>.*//g' -e 's@\n@|@g' `
206208
local profiles="${profiles}|${profile_pom}"
207209
done
210+
211+
IFS=$'|\n'
212+
208213
if [[ ${cur} == *,* ]] ; then
209214
COMPREPLY=( $(compgen -S ',' -W "${profiles}" -P "${cur%,*}," -- ${cur##*,}) )
210215
else

0 commit comments

Comments
 (0)