Index: mttroot/mtt/bin/mtt_help ================================================================== --- mttroot/mtt/bin/mtt_help +++ mttroot/mtt/bin/mtt_help @@ -12,10 +12,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.12 1998/07/21 08:47:59 peterg +## Default null $2 (regexp) to '^' - ie match any line +## ## Revision 1.11 1998/07/16 20:41:05 peterg ## Now uses new mtt_help ## ## Revision 1.10 1998/05/18 08:35:19 peterg ## Surround arguments to tr with "" @@ -59,10 +62,11 @@ regexp='^'; fi if [ "$topic" = "" ]; then echo 'Usage: mtt help representations' + echo ' mtt help simple' echo ' mtt help components' echo ' mtt help examples' echo ' mtt help CRs' echo ' mtt help representations ' echo ' mtt help components ' @@ -74,25 +78,33 @@ ext='_[cl]*.*[mt]' summary='[%#]SUMMARY' description='[%#]DESCRIPTION' alias='[%#]ALIAS' +lbl="_lbl.txt" case $topic in components) key=$summary - find_path=$MTT_COMPONENTS + find_path="$MTT_COMPONENTS" + name='' + sort='sort -u' + blurb="components";; + + simple) + key=$summary + find_path="$MTT_COMPONENTS/simple" name='' sort='sort -u' - blurb="Components";; + blurb="simple components";; crs) key=$summary find_path=$MTT_CRS name='*.cr' sort='sort -u' - blurb="Constitutive Relationships";; + blurb="constitutive relationships";; examples) key=$summary find_path=$MTT_EXAMPLES name='' @@ -107,32 +119,59 @@ all='all' sort='sort -u' blurb="Representations";; *) + other=OTHER; key="$summary|$description|$alias" find_path=$MTT_LIB name=$Topic all='all' sort='cat' blurb=$Topic;; - - esac subtopic=$2 if [ "$subtopic" = "" ]; then subtopic='.' fi; -echo $blurb - mtt_find $find_path "$name" |\ - awk '{print "cat " $1 "/" $2}' | sh |\ - egrep $key | egrep $regexp |\ + if [ "$topic" = "representations" ]; then + echo $blurb + mtt2reps_txt + else + fullnames=`mtt_find $find_path "$name" | awk '{printf("%s/%s\n",$1,$2)}'` + N=`echo $fullnames | wc -w`; + if [ -z "$fullnames" ]; then + echo No $blurb found. + else + echo $N $blurb found. + for fullname in $fullnames; do + name=`basename $fullname` + if [ -n "$other" ]; then + cat $fullname | egrep $key + else + info=`cat $fullname | egrep $key | awk '{for (i=2;i<=NF;i++) print $i}'` + category=`echo $fullname | sed "s!$find_path/!!" ` + category=`dirname $category` + echo $category $name $info + fi + done + fi + fi +exit + awk '{print "cat " $1 "/" $2}' | sh |\ + egrep $key | egrep $regexp |\ sed "s/$summary[ ]*//" |\ sed "s/$description[ ]*/ /" |\ sed "s/$alias[ ]*/ Alias: /" |\ sed "s!$find_path/!!" |\ $sort + + + + + +