Skip to content

Commit

Permalink
Merge pull request #1837 from NoahGorny/vendor-jboss-completion
Browse files Browse the repository at this point in the history
vendor jboss completion
  • Loading branch information
Noah Gorny authored Apr 26, 2021
2 parents b8da4cb + 64d827c commit d3bb347
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 160 deletions.
2 changes: 2 additions & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ completion/available/gem.completion.bash
completion/available/github-cli.completion.bash
completion/available/go.completion.bash
completion/available/helm.completion.bash
completion/available/jboss5.completion.bash
completion/available/jboss7.completion.bash
completion/available/jungle.completion.bash
completion/available/knife.completion.bash
completion/available/kontena.completion.bash
Expand Down
4 changes: 4 additions & 0 deletions completion/available/jboss5.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# shellcheck shell=bash
about-completion "jboss5 completion"
# shellcheck disable=SC1090
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss5
164 changes: 4 additions & 160 deletions completion/available/jboss7.completion.bash
Original file line number Diff line number Diff line change
@@ -1,160 +1,4 @@
# Completions for JBoss Application Server 7 (EAP 6)
# VERSION: 0.6
# DATE: 2012-10-30
# rparree-at-edc4it-dot-com

# MIT License

# Copyright (c) 2020 Raphael Parree

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

_serverProfiles(){
if [[ $COMP_WORDS == *standalone.sh* ]]
then
serverdir="../standalone/configuration/"
else
# assume is domain.sh
serverdir="../domain/configuration/"
fi

for i in ${!COMP_WORDS[*]}
do
if [[ "${COMP_WORDS[i]}" == "-Djboss.server.base.dir" || "${COMP_WORDS[i]}" == "-Djboss.domain.base.dir" ]]; then
serverdir="${COMP_WORDS[i+2]}/configuration"
fi

done
if [ -d "${serverdir}" ]
then

IFS=$'\n' tmp="$(ls "${serverdir}" | grep xml)"
local fls="${tmp[@]// /\ }"
unset IFS
COMPREPLY=( $(compgen -W "${fls} initial boot last v" -- "$cur" ))
fi
}

_bindingAddress(){
# from /etc/bash_completion.d/ssh
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
"0.0.0.0 $( PATH="$PATH:/sbin" ifconfig -a | \
sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \
-- "$cur" ) )
}

_jboss(){

local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n = cur prev words cword

case $cur in

-Djboss.socket.binding.port-offset=*)
cur=${cur#*=}
#static list of common bindings sets
local bindings="100 200 300 400 10000 20000 30000 40000"
COMPREPLY=( $(compgen -W "${bindings}" -- ${cur}) )
return 0
;;
-Djboss.default.jgroups.stack=*)
cur=${cur#*=}
#static list of standard JGroups stacks
local stacks="udp udp-async udp-sync tcp tcp-sync"
COMPREPLY=( $(compgen -W "${stacks}" -- ${cur}) )
return 0
;;

-Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef=*|-Dcom.sun.management.jmxremote.authenticate=*|-Dcom.sun.management.jmxremote.ssl=*)
cur=${cur#*=}
local booleans="true false"
COMPREPLY=( $(compgen -W "${booleans}" -- ${cur}) )
return 0
;;

-Djboss.server.base.dir=*|-Djboss.home.dir=*|-Djboss.domain.base.dir=*)
cur=${cur#*=}
_filedir -d
return 0
;;

-Djboss.domain.master.address=*|-Djboss.bind.address*=*)
cur=${cur#*=}
_bindingAddress
return 0
;;
--server-config=*|-c=|--host-config=*)
cur=${cur#*=}
_serverProfiles
return 0


esac


case $prev in
-u)
# a few from RFC 2365 IPv4 Local Scope ()
local addresses="239.255.0.1 239.255.0.2 239.255.0.3"
COMPREPLY=( $(compgen -W "${addresses}" -- ${cur}) )
return 0
;;
-b*)
_bindingAddress
return 0
;;
-c)
_serverProfiles
return 0
;;
*)
;;
esac
# *** from jboss5 ********************
# *** -modulepath -c -m -g -l -d -p -n -B -L -C -Djboss.platform.mbeanserver -Djboss.server.base.directory
# *** -Djboss.Domain -Djboss.modcluster.proxyList -Djboss.jvmRoute -Djboss.default.jgroups.stack -Dorg.jboss.ejb3.remoting.IsLocalInterceptor.passByRef -Djboss.platform.mbeanserver -Dcom.sun.management.jmxremote.port -Dcom.sun.management.jmxremote.ssl
# *************************************

# standard commands for standalone and domain mode
local commandsWithoutEqualSign='-b -bmanagement -bunsecure -bpublic --admin-only -h -help -u -version -V -v'
local commandsWithEqualSign='-P -Djboss.node.name -Djboss.home.dir -Djboss.socket.binding.port-offset -Djboss.bind.address.management -Djboss.bind.address -Djboss.bind.address.unsecure'

if [[ $COMP_WORDS == *standalone.sh* ]]
then
commandsWithoutEqualSign="${commandsWithoutEqualSign} -c"
commandsWithEqualSign="${commandsWithEqualSign} --server-config -Djboss.server.base.dir -c"
else
# assume is domain.sh
commandsWithoutEqualSign="${commandsWithoutEqualSign} --backup --cached-dc"
commandsWithEqualSign="${commandsWithEqualSign} -Djboss.domain.master.address --host-config -Djboss.domain.master.port -Djboss.domain.base.dir "
fi




COMPREPLY=( $( compgen -W "$commandsWithoutEqualSign" -- "$cur" )
$( compgen -W "$commandsWithEqualSign" -S '=' -- "$cur" ) )
return 0


}
complete -o nospace -F _jboss standalone.sh
complete -o nospace -F _jboss domain.sh
# shellcheck shell=bash
about-completion "jboss7 completion"
# shellcheck disable=SC1090
source "${BASH_IT}"/vendor/github.com/rparree/jboss-bash-completion/jboss7
21 changes: 21 additions & 0 deletions vendor/github.com/rparree/jboss-bash-completion/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions vendor/github.com/rparree/jboss-bash-completion/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions vendor/github.com/rparree/jboss-bash-completion/jboss5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d3bb347

Please sign in to comment.