#!/bin/bash
################################################################
# Copyright (C) 2002 Robert Anderson
# Copyright (C) 2003 Walter Landry and the Regents of the University
#                                          of California
# Minor bug fix for new help layout 2004 Walter Landry
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
# 

cachedir=~/.arx-cmd-opts

rm -rf $cachedir
mkdir $cachedir
cd $cachedir

arx -H | grep "^   [a-z]" | awk '{print $1}' | tr "\n" " " > arx-subcmds

# Collect options for subcommands
subcmds=`cat arx-subcmds`
 
for subcmd in $subcmds; do
    arx $subcmd --help | grep "^ -[a-zA-Z]" | awk '{print $1}' | tr "\n" " " > $subcmd-options
    arx $subcmd --help | grep "^ -[a-zA-Z]" | awk '{print $2}' | tr "\n" " " >> $subcmd-options
    arx $subcmd --help | grep "^ --[a-zA-Z]" | awk '{print $1}' | tr "\n" " " >> $subcmd-options
done

# Collect options for arx itself

arx --help | grep "^ -[a-zA-Z]" | awk '{print $1}' | tr "\n" " " > arx-options
arx --help | grep "^ -[a-zA-Z]" | awk '{print $2}' | tr "\n" " " >> arx-options
arx --help | grep "^ --[a-zA-Z]" | awk '{print $1}' | tr "\n" " " >> arx-options

###  Local Variables:
###  mode: shell-script
###  End:

# tag: Robert Anderson Sat Nov 16 22:28:38 PST 2002 (gen-opt-cache)

