From e75f46c85c69aff674781d0e2575f4e6698da7fa Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sun, 18 Sep 2011 21:13:33 +0200 Subject: [PATCH] #7 JOnAS: remove unneded wrapper function --- _jonas | 150 +++++++++++++++++++++++++++------------------------------ 1 file changed, 72 insertions(+), 78 deletions(-) diff --git a/_jonas b/_jonas index e0453cb..bd75c38 100644 --- a/_jonas +++ b/_jonas @@ -43,84 +43,78 @@ typeset -A opt_args -local context state line curcontext="$curcontext" +local context state line curcontext="$curcontext" ret=1 -_jonas() { - local ret=1 +_arguments -C \ + '1:cmd:->cmds' \ + '*::arg:->args' \ +&& ret=0 - _arguments -C \ - '1:cmd:->cmds' \ - '*::arg:->args' \ - && ret=0 +case "$state" in + (cmds) + local commands; commands=( + 'version:show version information' + 'check:check that the JOnAS environment is correctly set' + 'start:start a server instance' + 'stop:stop a server instance' + 'admin:administrate a server instance' + ) + _describe -t commands 'command' commands && ret=0 + ;; + (args) + curcontext="${curcontext%:*:*}:jonas-cmd-$words[1]:" + case $words[1] in + (version|check) + _message 'no more arguments' && ret=0 + ;; + (start) + _arguments \ + '-standby[start a minimal JOnAS server with only mandatory services]' \ + '(-bg)-fg[start the server in foreground mode]' \ + '(-fg)-bg[start the server in background mode]' \ + '-win[start the server in a new window]' \ + '(-bg)-tui[start the Apache Felix TUI (force foreground mode)]' \ + '-gui[start the Apache Felix GUI]' \ + '-dev[start a JOnAS server by using bundles present in the default maven repository instead of bundles under $JONAS_ROOT/lib/bundles]' \ + '-clean[clean the Apache Felix cache before starting a JOnAS server]' \ + '-n[set the server name, must be unique in the domain (default: jonas)]:name' \ + '-target[start another server or cluster (group of servers) in the domain]:server' \ + '-Ddomain.name=[set the name of the management domain to which the server belongs]:domain' \ + && ret=0 + ;; + (stop) + _arguments \ + '-standby[stop all services except the mandatory ones]' \ + '-n[set the name of the server to stop (default: jonas)]:name' \ + '-target[stop another server or cluster (group of servers) in the domain]:server' \ + '-Ddomain.name=[set the name of the management domain to which the server belongs]:domain' \ + && ret=0 + ;; + (admin) + _arguments \ + '(- : *)-?[print the help message]' \ + '-win[administer the server in a new window]' \ + '-n[set the name of the server to administer (default: jonas)]:name' \ + '-username[set the username when authentication is required]: :_users' \ + '-password[set the password when authentication is required]:password' \ + '-registry[set the registry URL]: :_urls' \ + '-protocol[set the protocol name]:protocol:((jrmp\:JRE\ implementation\ of\ RMI\ on\ the\ JRMP\ protocol\ \(default\) iiop\:JacORB\ implementation\ of\ RMI\ over\ the\ IIOP\ protocol irmi\:Oracle\ JRE\ independant\ implementation\ of\ RMI))' \ + '-a[deploy an application from a given filepath on the current server, or on another target in the domain if the current server is a master]:Java application archive:_files -g "*.(j|w|r|e)ar"' \ + '-r[undeploy a previously deployed application from the current server or from the specified target if the current server is a master]:Java application archive:_files -g "*.(j|w|r|e)ar"' \ + '-gc[run the garbage collector on the current JOnAS server]' \ + '-passivate[passivate all entity bean instances]' \ + '-e[list the properties of the current JOnAS server]' \ + '-j[list the registered JNDI names, as seen by the current JOnAS server]' \ + '-l[list the beans currently loaded by the current JOnAS server]' \ + '-synch[synchronize the entity bean instances on the current JOnAS server]' \ + '-debug[set the logging level for the given topic to DEBUG]:topic' \ + '-tt[change the default timeout for transactions]:timeout (seconds)' \ + '-ping[wait until the JOnAS server is available]' \ + '-timeout[maximum time to wait when -ping is used]:timeout (seconds)' \ + && ret=0 + ;; + esac + ;; +esac - case "$state" in - (cmds) - local commands; commands=( - 'version:show version information' - 'check:check that the JOnAS environment is correctly set' - 'start:start a server instance' - 'stop:stop a server instance' - 'admin:administrate a server instance' - ) - _describe -t commands 'command' commands && ret=0 - ;; - (args) - curcontext="${curcontext%:*:*}:jonas-cmd-$words[1]:" - case $words[1] in - (version|check) - _message 'no more arguments' && ret=0 - ;; - (start) - _arguments \ - '-standby[start a minimal JOnAS server with only mandatory services]' \ - '(-bg)-fg[start the server in foreground mode]' \ - '(-fg)-bg[start the server in background mode]' \ - '-win[start the server in a new window]' \ - '(-bg)-tui[start the Apache Felix TUI (force foreground mode)]' \ - '-gui[start the Apache Felix GUI]' \ - '-dev[start a JOnAS server by using bundles present in the default maven repository instead of bundles under $JONAS_ROOT/lib/bundles]' \ - '-clean[clean the Apache Felix cache before starting a JOnAS server]' \ - '-n[set the server name, must be unique in the domain (default: jonas)]:name' \ - '-target[start another server or cluster (group of servers) in the domain]:server' \ - '-Ddomain.name=[set the name of the management domain to which the server belongs]:domain' \ - && ret=0 - ;; - (stop) - _arguments \ - '-standby[stop all services except the mandatory ones]' \ - '-n[set the name of the server to stop (default: jonas)]:name' \ - '-target[stop another server or cluster (group of servers) in the domain]:server' \ - '-Ddomain.name=[set the name of the management domain to which the server belongs]:domain' \ - && ret=0 - ;; - (admin) - _arguments \ - '(- : *)-?[print the help message]' \ - '-win[administer the server in a new window]' \ - '-n[set the name of the server to administer (default: jonas)]:name' \ - '-username[set the username when authentication is required]: :_users' \ - '-password[set the password when authentication is required]:password' \ - '-registry[set the registry URL]: :_urls' \ - '-protocol[set the protocol name]:protocol:((jrmp\:JRE\ implementation\ of\ RMI\ on\ the\ JRMP\ protocol\ \(default\) iiop\:JacORB\ implementation\ of\ RMI\ over\ the\ IIOP\ protocol irmi\:Oracle\ JRE\ independant\ implementation\ of\ RMI))' \ - '-a[deploy an application from a given filepath on the current server, or on another target in the domain if the current server is a master]:Java application archive:_files -g "*.(j|w|r|e)ar"' \ - '-r[undeploy a previously deployed application from the current server or from the specified target if the current server is a master]:Java application archive:_files -g "*.(j|w|r|e)ar"' \ - '-gc[run the garbage collector on the current JOnAS server]' \ - '-passivate[passivate all entity bean instances]' \ - '-e[list the properties of the current JOnAS server]' \ - '-j[list the registered JNDI names, as seen by the current JOnAS server]' \ - '-l[list the beans currently loaded by the current JOnAS server]' \ - '-synch[synchronize the entity bean instances on the current JOnAS server]' \ - '-debug[set the logging level for the given topic to DEBUG]:topic' \ - '-tt[change the default timeout for transactions]:timeout (seconds)' \ - '-ping[wait until the JOnAS server is available]' \ - '-timeout[maximum time to wait when -ping is used]:timeout (seconds)' \ - && ret=0 - ;; - esac - ;; - esac - - return ret -} - -_jonas "$@" +return ret