zsh-users
 help / color / mirror / code / Atom feed
* zsh completion for ATG dynamo
@ 2002-03-28 20:43 Will Sargent
  0 siblings, 0 replies; only message in thread
From: Will Sargent @ 2002-03-28 20:43 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hi again;

I raided the _java completion script to get the information about the
completion options for startDynamo, stopDynamo, checkDynamo and a bunch of
other completion options.  I'm posting them here in case someone else finds
them useful.

Note that I had some problems trying to expand out the servers options.  I
could not get _servers to autoload for some reason, so I just stuck it in
the _startDynamo script itself.

Please e-mail me with an improvements you make to these scripts.  I only
have a vague idea of all the possible complexities (notably I'm weak in
compset), so any help is appreciated.

Will.

[-- Attachment #2: _startDynamo --]
[-- Type: application/octet-stream, Size: 4195 bytes --]

#compdef startDynamo stopDynamo startSQLRepository checkDynamo runDarina

# startDynamo completion script.
# This is mostly borrowed from the _java script, but I've edited
# what I need to get modules and servers to work.

# Copyright (C) 2002 Will Sargent <wsargent@atg.com> 

# For some wierd reason, we need to load up _servers 
# manually.  I think this may be my screw up.

autoload -U _servers

# We also need $DYNAMO_HOME defined because we use it to determine
# modules.
if [ -r bin/startDynamo ] ; then
  DYNAMO_HOME=`pwd`
elif [ "$DYNAMO_HOME" = "" ] ; then
   echo 'Please set the DYNAMO_HOME environment variable.' 
   exit 1
else
  if [ ! -r ${DYNAMO_HOME}/bin/startDynamo ] ; then
    echo Unable to find ${DYNAMO_HOME}/bin/startDynamo - invalid setting of DYNAMO_HOME
    exit 1
  fi
fi

# Define some local variables copied from _java here...
local expl tmp match basedir
local curcontext="$curcontext" state line

typeset -A opt_args tmpassoc

case "$service" in
startDynamo)
  _arguments \
    '-m[run additionally with the specified modules]:modules:->modules' \
    '-w[run ATG Dynamo Control Center and ATG Dynamo Application Server in one VM]' \
    '-n[disable ATG Dynamo Control Center access]' \
    '-v[print version info and exit]' \
    '-i[print IP addresses of this machine and exit]' \
    '-b[run the base configuration - do not include installed apps]' \
    '*:server:_servers' \
    && return 0
  ;;

stopDynamo)
  _arguments \
    '-user[the admin user name]' \
    '-password[the password]' \
    '-configPath[the configuration path]' \
    '-restart[restart the server]' \
    '-stopsessions[stop the sessions]' \
    '*:server:_servers' \
    && return 0
  ;;

checkDynamo)
  _arguments \
    '-url[URL to check if the server is still running]' \
    '-email[Send email notification if URL check fails]' \
    '-restart[Restart the server if URL check fails]' \
    '-user[Name of administrator]' \
    '-password[Administrator password]' \
    '-verbose[Output additional information during this command]' \
    '*:server:_servers' \
    && return 0
  ;;
  
runDarina)
  _arguments \
    '-dar-version' \
    '-q[Be quieter (fewer status messages)]' \
    '-Q[Be very quiet (only error messages)]' \
    '-separate-ejb-class-loaders[Do not allow EJB modules to share classes]' \
    '-overwrite-dar[Overwrite existing DAR file (now the default).]' \
    '-regen[Regenerate impl and stub RMI files.]' \
    '-rmi[Uses "regular" rmi (JRMP) as the ejb protocol.]' \
    '-no-java-src[Do not include any .java files in the final DAR.]' \
    '-no-dar[Do not generate a dar file (still validates and generates EJB client jars.)]' \
    '-iiop[Uses RMI-IIOP as the ejb protocol.]' \
    '-debug[Print out debugging information.]' \
    '-build[Compile source files.]' \
    '-buildall[Re-compile all source files.]' \
    '-compiler[Specify the default javac compiler command.]' \
    '-usage[Shows usage flags for runDarina]' \
    '-merge-ejbc-class-loaders[Allow EJB modules to share all classes.]' \
    '-server[Loads the dynamo environment for the specified server]:server:_servers' \
    && return 0
  ;;
    
startSQLRepository)
  _arguments \
    '-m[list of module names separated by ;]:modules:->modules' \
    '-s[server name]' \
    '-repository[nucleus path to the repository]' \
    '-outputSQL' \
    '-outputSQLFile' \
    '-verboseSQL' \
    '-debug' \
    '-database' \
    '-export' \
    '-exportRepositories' \
    '-database' \
    '-encoding' \
    '-import' \
    '-noTransaction' \
    '*:server:_servers' \
    && return 0
  ;;
esac

# Start a new case statement.  
[[ -n "$state" ]] &&
case "$state" in
debug)
  if [[ -prefix :*, ]]; then
    compset -P :
    _values -s , lines vars source
  else
    compadd -P: none
    compadd -P: -qS, lines vars source
  fi
  ;;
  
modules)
  cd $DYNAMO_HOME/..
  match=()
  compset -P '(#b)(*.)'
  basedir=${match[1]//.//}
  _alternative \
    'modules:module:compadd -qS. $basedir*~$basedir*.*(/:t)'
  ;;

*)
  _message "unknown state: $state"
  ;;
esac

[-- Attachment #3: _servers --]
[-- Type: application/octet-stream, Size: 178 bytes --]

#compdef -servers-

local match basedir

cd $DYNAMO_HOME/servers
match=()
compset -P '(#b)(*.)'
basedir=${match[1]//.//}
_alternative 'servers:server:compadd $basedir*'

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-03-28 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-28 20:43 zsh completion for ATG dynamo Will Sargent

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).