#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: mtt_help
# P.J.Gawthrop Nov 1996
# Copyright (c) P.J.Gawthrop 1996
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.4 1997/09/04 09:16:29 peterg
# Removed sort -u
#
## Revision 1.3 1996/11/09 21:10:20 peterg
## Tidied up searches by putting everyrhing into lib.
##
# Revision 1.2 1996/11/02 10:22:54 peterg
# Now browses crs.
#
## Revision 1.1 1996/11/01 12:34:54 peterg
## Initial revision
##
###############################################################
topic=$1
if [ "$topic" = "" ]; then
echo 'Usage: mtt help representations'
echo ' mtt help components'
echo ' mtt help examples'
echo ' mtt help CRs'
echo ' mtt help representations <match_string>'
echo ' mtt help components <match_string>'
echo ' mtt help examples <match_string>'
echo ' mtt help CRs <match_string>'
echo ' mtt help <component_or_example_or_CR_name>'
exit
fi
ext='*'
summary='[%#]SUMMARY'
description='[%#]DESCRIPTION'
case $topic in
components)
key=$summary
find_path=$MTT_COMPONENTS
name='*_*.*'
sort='sort -u'
blurb="Components";;
crs)
key=$summary
find_path=$MTT_CRS
name='*.cr'
sort='sort -u'
blurb="Constitutive Relationships";;
examples)
key=$summary
find_path=$MTT_EXAMPLES
name='*_lbl.txt'
all='all'
sort='sort -u'
blurb="Examples";;
representations)
key=$summary
find_path=$MTTPATH/mtt
name='mtt'
all='all'
sort='sort -u'
blurb="Representations";;
*)
key="\"$summary|$description\""
find_path=$MTT_LIB
name=$topic$ext
all=''
sort='cat'
blurb=$topic;;
esac
subtopic=$2
if [ "$subtopic" = "" ]; then
subtopic='.'
fi;
echo $blurb
mtt_find $find_path "$name" "egrep -i $key.*$subtopic" $all|\
sed "s/$summary[ ]*/ /" |\
sed "s/$description[ ]*/ /" | $sort