Skip to content

Commit 9e3c9f1

Browse files
committed
1 parent 106b6ca commit 9e3c9f1

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

bash_completion.bash

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ __ltrim_colon_completions()
4646
fi
4747
}
4848

49+
__docker_compose_services()
50+
{
51+
if [[ -f "target/carnotzet/docker-compose.yml" ]]; then
52+
docker-compose -f target/carnotzet/docker-compose.yml config --services
53+
fi
54+
}
55+
4956
function_exists __find_mvn_projects ||
5057
__find_mvn_projects()
5158
{
@@ -118,7 +125,7 @@ _mvn()
118125
COMPREPLY=()
119126
POM_HIERARCHY=()
120127
__pom_hierarchy
121-
_get_comp_words_by_ref -n : cur prev
128+
_get_comp_words_by_ref -n := cur prev words
122129

123130
local opts="-am|-amd|-B|-C|-c|-cpu|-D|-e|-emp|-ep|-f|-fae|-ff|-fn|-gs|-h|-l|-N|-npr|-npu|-nsu|-o|-P|-pl|-q|-rf|-s|-T|-t|-U|-up|-V|-v|-X"
124131
local long_opts="--also-make|--also-make-dependents|--batch-mode|--strict-checksums|--lax-checksums|--check-plugin-updates|--define|--errors|--encrypt-master-password|--encrypt-password|--file|--fail-at-end|--fail-fast|--fail-never|--global-settings|--help|--log-file|--non-recursive|--no-plugin-registry|--no-plugin-updates|--no-snapshot-updates|--offline|--activate-profiles|--projects|--quiet|--resume-from|--settings|--threads|--toolchains|--update-snapshots|--update-plugins|--show-version|--version|--debug"
@@ -185,6 +192,7 @@ _mvn()
185192
local plugin_goals_spring_boot="spring-boot:run|spring-boot:repackage"
186193
local plugin_goals_jgitflow="jgitflow:feature-start|jgitflow:feature-finish|jgitflow:release-start|jgitflow:release-finish|jgitflow:hotfix-start|jgitflow:hotfix-finish|jgitflow:build-number"
187194
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"
195+
local plugin_goals_zet="addrs|clean|crawl|help|logs|ps|pull|restart|run|shell|start|stop|welcome"
188196

189197
## some plugin (like jboss-as) has '-' which is not allowed in shell var name, to use '_' then replace
190198
local common_plugins=`compgen -v | grep "^plugin_goals_.*" | sed 's/plugin_goals_//g' | tr '_' '-' | tr '\n' '|'`
@@ -202,7 +210,24 @@ _mvn()
202210

203211
local IFS=$'|\n'
204212

205-
if [[ ${cur} == -D* ]] ; then
213+
if [[ ${words[1]} == zet:* ]] ; then
214+
if [[ ${cur} == -Dgoal=* ]] ; then
215+
COMPREPLY=( $(compgen -S ' ' -W "${plugin_goals_zet}" -- ${cur#*=}) )
216+
elif [[ ${cur} == -Dservice=* ]] ; then
217+
COMPREPLY=( $(compgen -S ' ' -W "$(__docker_compose_services)" -- ${cur#*=}) )
218+
elif [[ ${cur} == -D* ]] ; then
219+
if [[ ${words[1]} == zet:logs ]] ; then
220+
COMPREPLY=( $(compgen -S ' ' -W "-Dfollow=false|-Dtail=5" -- ${cur}) )
221+
elif [[ ${words[1]} == zet:help ]] ; then
222+
COMPREPLY=( $(compgen -S '=' -W "-Ddetail=true -Dgoal" -- ${cur}) )
223+
else
224+
COMPREPLY=( $(compgen -S '=' -W "-Dservice" -- ${cur}) )
225+
fi
226+
elif [[ ${cur} == *:* ]] ; then
227+
COMPREPLY=( $(compgen -W "${plugin_goals_zet}" -S ' ' -- ${cur#*:}) )
228+
fi
229+
230+
elif [[ ${cur} == -D* ]] ; then
206231
COMPREPLY=( $(compgen -S ' ' -W "${options}" -- ${cur}) )
207232

208233
elif [[ ${prev} == -P ]] ; then

0 commit comments

Comments
 (0)