Skip to content

Commit 5aee85e

Browse files
committed
fix: sed + profile (continuation)
1 parent 1eddcbc commit 5aee85e

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
@@ -185,24 +185,29 @@ _mvn()
185185
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"
186186

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

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

192-
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-
192+
local OIFS=$IFS
194193
local IFS=$'|\n'
195194

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

199198
elif [[ ${prev} == -P || ${prev} == --activate-profiles ]] ; then
199+
IFS=$OIFS
200+
201+
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' `
200202
local profiles="${profile_settings}|"
201203
for item in ${POM_HIERARCHY[*]}
202204
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' '|' `
205+
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' `
204206
local profiles="${profiles}|${profile_pom}"
205207
done
208+
209+
IFS=$'|\n'
210+
206211
if [[ ${cur} == *,* ]] ; then
207212
COMPREPLY=( $(compgen -S ',' -W "${profiles}" -P "${cur%,*}," -- ${cur##*,}) )
208213
else

0 commit comments

Comments
 (0)