help.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*-*/
00002 /*  (C) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>*/
00003 /** 
00004  * ###
00005  */
00006 
00007 namespace ::sak::help {}
00008 
00009 /*  ###*/
00010 
00011 ret  ::sak::help::print (type text) {
00012     global critcldefault
00013     puts stdout [string map \
00014         [list @@ $critcldefault] $text]
00015     return
00016 }
00017 
00018 ret  ::sak::help::on (type topic) {
00019     variable base
00020 
00021     # Look for static text and dynamic, i.e. generated help.
00022     # Static is prefered.
00023 
00024     set ht [file join $base $topic help.txt]
00025     if {[file exists $ht]} {
00026     return [get_input $ht]
00027     }
00028 
00029     set ht [file join $base $topic help.tcl]
00030     if {[file exists $ht]} {
00031     source $ht
00032     return [sak::help::on::$topic]
00033     }
00034 
00035     set    help ""
00036     append help \n
00037     append help "    The topic \"$topic\" is not known." \n
00038     append help "    The known topics are:" \n\n
00039 
00040     append help [topics]
00041 
00042     return $help
00043 }
00044 
00045 ret  ::sak::help::alltopics () {
00046     # Locate the quick-help for all topics and combine it with a
00047     # general header.
00048 
00049     set    help "\n"
00050     append help "    SAK - Swiss Army Knife\n\n"
00051     append help "    sak is a tool to ease the work"
00052     append help " of developers and release managers. Try:\n\n"
00053     append help [topics]
00054 
00055     return $help
00056 }
00057 
00058 ret  ::sak::help::topics () {
00059     variable base
00060     set help ""
00061     foreach f [lsort [glob -nocomplain -directory $base */topic.txt]] {
00062     append help \tsak\ help\ [get_input $f]
00063     }
00064     return $help
00065 }
00066 
00067 /*  ###*/
00068 
00069 namespace ::sak::help {
00070     variable base [file join $::distribution support devel sak]
00071 }
00072 
00073 /** 
00074  * ###
00075  */
00076 
00077 package provide sak::help 1.0
00078 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1