File mttroot/mtt/bin/mtt_help artifact 5bcadcde84 part of check-in 3025d1c8ef


#! /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.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 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>'
fi

subtopic=$2
if [ "$subtopic" = "" ]; then
  subtopic='.'
fi;

if [ "$topic" = "components" ]; then
  echo 'Components:'
  find $MTTPATH/lib/comp \
    -name '*_lbl.txt' \
    -exec grep -i "%SUMMARY.*$subtopic.*" {} \; |\
  sed "s/%SUMMARY[	]*/  /" |\
  sort


elif [ "$topic" = "examples" ]; then
  echo 'Examples:'
  find $MTTPATH/lib/examples -name '*_lbl.txt' \
    -exec grep -i "%SUMMARY.*$subtopic.*" {} \; |\
  sed "s/%SUMMARY[	]*/  /" |\
  sort


elif [ "$topic" = "representations" ]; then
  echo 'Representations:'
  grep  '#REPRESENTATION' $MTTPATH/mtt |\
  sed 's/#REPRESENTATION[	]*/  /' |\
  grep -i $subtopic |\
  sort

elif [ "$topic" = "crs" ]; then
  echo 'Constitutive relationships'
  grep -h '\%SUMMARY' \
	*.cr \
	$MTTPATH/lib/cr/r/*.cr 2>/dev/null |\
  sed 's/\%SUMMARY[ ]*/	/' |\
  grep -i $subtopic |\
  sed 's/:[ ]*/	/' |\
  sort

else
  find $MTTPATH/lib \
   -name "$1_lbl.txt" \
   -exec grep  "%SUMMARY" {} \; \
   -exec grep  "%DESCRIPTION" {} \; |\
  sed "s/%SUMMARY[	]*//" |\
  sed "s/%DESCRIPTION[	]*/  /"
fi;






MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]