# JStrack:  copyright 1997/2010 by Jim Graham, N5IAL, all rights reserved.
#

proc help {{proc ""}} {
   global shell

   if {$proc == ""} {
      puts "
You are at the command level for the hurricane tracker.  There are a
number of commands that you can run at this level to get information
about the storm.

For more information about the $shell procedures available, use
\"help commands\"

Note that when a storm name, timestamp, etc., is required, the
information is NOT case-sensitive.  The indexes used within the
program are all uppercase, but your arguments to these commands
will be converted to uppercase by the program.  The command names
themselves are case-sensitive, however.

Because this is all a series of $shell scripts, you can even add
your own commands if you want to.  If you do, please send me a copy
so I can make them available to others.
"
   } elseif {$proc == "commands"} {
      puts "
The commands (procedures) currently implemented are:

   st_index: get a listing of available current/past positions
   st_info:  display storm information for a current/past position
   st_hist:  display the history of a storm
   fc_index: get a listing of available forecast positions
   fc_info:  display specific forecast information
   read_adv: read the actual NHC advisory texts
   st_data:  manually input data for storm
   history:  display the commands in the history buffer
   sschart:  display the Saffir-Simpson scale
"
   } elseif {$proc == "sschart"} {
      puts "
   sschart
            This command displays the Saffir-Simpson scale
"
   } elseif {$proc == "read_adv"} {
      puts "
   read_adv
            This command allows you to search for and read the NHC
            advisories from the tracker.  This is a very crude
            implementation, and makes a number of assumptions.  First,
            it assumes that all storm data is in the directory where
            you've configured the tracker to look for the storm track
            files (default is ./storms).  Second, it assumes the
            following filename.extension format:

               FORECAST/ADVISORY:    storm_name.fc    (e.g., lili.fc)
               ADVISORY:             storm_name.adv   (e.g., lili.adv)
               DISCUSSION:           storm_name.dis   (e.g., lili.dis)
               PROBABILITIES:        storm_name.prob  (e.g., lili.prob)

            One problem you may run into is tropical depressions.  If
            you group them in with the named storm it eventually turns
            into (assuming it does), you will need to create a symbolic
            link using the depression's name, pointing to the file its
            data is actually in.

            Press RETURN for more ....
"
      gets stdin
      puts "
            This command searches for advisories (etc.) by the
            advisory number.  You will, therefore, need to know
            the actual advisory number you are looking for.

            If you want to use an external pager to display the
            information, instead of the horribly-crude pager I've
            hacked out, you will need to do the following:

               1) make sure you're using either the Expect or TclX
                  extension to Tcl, as I haven't gotten this to work
                  under pure Tcl yet.
               2) set the PAGER environment variable to the pager
                  you wish to use
"
   } elseif {$proc == "fc_index"} {
      puts "
   fc_index \[storm_name]
            returns the forecast positions available for that storm
            (or for all storms loaded, if no specific name is given).
"
   } elseif {$proc == "st_index"} {
      puts "
   st_index \[storm_name]
            returns the current/past positions available for that
            storm (or for all storms loaded, if no specific name is
            given).
"
   } elseif {$proc == "st_hist"} {
      puts "
   st_hist storm_name
            displays a history of the named storm in a table.
"
   } elseif {$proc == "fc_info"} {
      puts "
   fc_info:  storm_name advisory_timestamp \[forecast_timestamp]
         returns the forecast positions for the storm as of the
         time of the advisory specified (advisory_timestamp).  If
         a specific forecast position's timestamp is given, only
         that forecast position is given.  Otherwise, all forecast
         positions for the advisory are listed.
"
   } elseif {$proc == "st_info"} {
      puts "
   st_info:  storm_name timestamp
         returns the current position and related data for the storm
         as of the time of the advisory specified (timestamp).
"
   } elseif {$proc == "st_data"} {
      puts "
   st_data:  \[storm_name]
         used to manually enter data for a storm.  If no storm name
         is specified, you will be prompted for it.
"
   } elseif {$proc == "history"} {
      puts "
   history:  \[info count]
         Display the commands in the history buffer, along with the.
         event number.  Commands may be re-run by using !#, where
         the '#' is the event number, !{string}, where {string} is
         the first part of the command to run (e.g., !st would match
         the most recent of st_info, st_data, etc., !st_d would match
         the most recent st_data, and so on), or !!, which re-runs
         the most recent command.  You can also replace parts of the
         previous command using \"^old^new\".  This is similar to csh's
         history.  If {count} is specified, only the most recent {count}
         commands will be displayed, e.g.,

            history info 5

         would display the 5 most recent commands.
"
   } else {
      puts "I don't know anything about $proc"
   }
}


