A => +72 -0
@@ 0,0 1,72 @@
#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}
# taken from
# https://github.com/jcowgar/misctcl/blob/master/docextract.tcl
package require cmdline
proc main {} {
if {[llength $::argv] == 0} {
puts "Invalid usage, please use -help for help."
exit 0
}
set options {
{o.arg "./" "set the output directory"}
{ext.arg "man" "set the extension of the extracted document files"}
{doctools.arg no "generate HTML output via doctools package"}
{all "output output even when no valid comments where found"}
}
set usage "\[options] filename1 \[filename2] \[...]\noptions:"
if {[catch {array set params [::cmdline::getoptions ::argv $options $usage]} msg]} {
puts $msg
exit 0
}
if {$params(doctools)} {
package require doctools
}
file mkdir $params(o)
foreach fname $::argv {
set fh [open $fname r]
set comments ""
set inDocComment 0
while {[gets $fh line] >=0} {
set line [string trim $line]
if {$inDocComment && [string index $line 0] != "#"} {
set inDocComment 0
} elseif {[string range $line 0 1]=="#*"} {
set inDocComment 1
} elseif {$inDocComment} {
append comments "[string range $line 2 end]\n"
}
}
close $fh
if {$params(all) || [string length $comments] > 0} {
set ofh [open [file join $params(o) [file rootname $fname].$params(ext)] w]
puts $ofh $comments
close $ofh
if {$params(doctools)} {
::doctools::new .dt -format html
set html [.dt format $comments]
set ofh [open [file join $params(o) [file rootname $fname].html] w]
puts $ofh $html
close $ofh
}
}
}
}
main
A bin/docgen.tcl => bin/docgen.tcl +52 -0
@@ 0,0 1,52 @@
+#!/bin/env tclsh
+
+set files {
+ *.tcl
+ spdx/lib.tcl
+ ui/*.tcl
+ db/*.tcl
+ irc/*.tcl
+}
+
+set basedir \
+ [file normalize \
+ [file join \
+ [file dirname \
+ [dict get [info frame [info frame]] file]] ..]]
+
+cd [file join $basedir src]
+
+set files [glob -nocomplain {*}$files]
+
+file mkdir [file join $basedir doc doctools gen]
+exec -- [file join $basedir bin docextract.tcl] -o [file join $basedir doc doctools gen] -all {*}$files
+
+package require doctools
+doctools::new .doc
+.doc configure -format markdown -ibase [file join $basedir doc doctools]
+
+cd [file join $basedir doc doctools gen]
+
+set to_check .
+while {[llength $to_check]} {
+ set to_check [lassign $to_check cur]
+ foreach file [glob -directory $cur -types f -nocomplain *.man] {
+ set ofile [file rootname $file].md
+ set opath [file join $basedir doc md $ofile]
+ file mkdir [file dirname $opath]
+
+ .doc configure -file $ofile
+
+ set ifd [open $file r]
+ set ofd [open $opath w]
+ puts -nonewline $ofd [.doc format [read $ifd]]
+ close $ifd
+ close $ofd
+
+ # TODO: postprocess to remove toc
+
+ puts $ofile
+ }
+
+ lappend to_check {*}[glob -directory $cur -types d -nocomplain *]
+}
A doc/doctools/gen/cap.man => doc/doctools/gen/cap.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin cap tclircc 0.0.1]
+[titledesc {Library cap.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/db/main.man => doc/doctools/gen/db/main.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin db_thread tclircc 0.0.1]
+[titledesc {Thread tclircc::db}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/irc.man => doc/doctools/gen/irc.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin irc tclircc 0.0.1]
+[titledesc {Library irc.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/irc/main.man => doc/doctools/gen/irc/main.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin irc_thread tclircc 0.0.1]
+[titledesc {Thread tclircc::irc}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/main.man => doc/doctools/gen/main.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin main_thread tclircc 0.0.1]
+[titledesc {Thread main}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/migrate_core.man => doc/doctools/gen/migrate_core.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin migrate_core tclircc 0.0.1]
+[titledesc {Script migrate_core.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/plugins.man => doc/doctools/gen/plugins.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin plugins tclircc 0.0.1]
+[titledesc {Component plugins.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/spdx/lib.man => doc/doctools/gen/spdx/lib.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin spdx tclircc 0.0.1]
+[titledesc {Library spdx/lib.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/threads.man => doc/doctools/gen/threads.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin threads tclircc 0.0.1]
+[titledesc {Component threads.tcl}]
+[description]
+[manpage_end]
+
A doc/doctools/gen/ui/main.man => doc/doctools/gen/ui/main.man +5 -0
@@ 0,0 1,5 @@
+[manpage_begin ui_thread tclircc 0.0.1]
+[titledesc {Thread tclircc::ui}]
+[description]
+[manpage_end]
+
A doc/md/cap.md => doc/md/cap.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (cap \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (cap\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+cap \- Library cap\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/db/main.md => doc/md/db/main.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (db\_thread \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (db\_thread\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+db\_thread \- Thread tclircc::db
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/irc.md => doc/md/irc.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (irc \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (irc\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+irc \- Library irc\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/irc/main.md => doc/md/irc/main.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (irc\_thread \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (irc\_thread\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+irc\_thread \- Thread tclircc::irc
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/main.md => doc/md/main.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (main\_thread \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (main\_thread\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+main\_thread \- Thread main
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/migrate_core.md => doc/md/migrate_core.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (migrate\_core \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (migrate\_core\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+migrate\_core \- Script migrate\_core\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/plugins.md => doc/md/plugins.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (plugins \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (plugins\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+plugins \- Component plugins\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/spdx/lib.md => doc/md/spdx/lib.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (spdx \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (spdx\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+spdx \- Library spdx/lib\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/threads.md => doc/md/threads.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (threads \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (threads\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+threads \- Component threads\.tcl
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
A doc/md/ui/main.md => doc/md/ui/main.md +16 -0
@@ 0,0 1,16 @@
+
+[//000000001]: # (ui\_thread \- )
+[//000000002]: # (Generated from file 'doctools' by tcllib/doctools with format 'markdown')
+[//000000003]: # (ui\_thread\(tclircc\) 0\.0\.1 "")
+
+# NAME
+
+ui\_thread \- Thread tclircc::ui
+
+# <a name='toc'></a>Table Of Contents
+
+ - [Table Of Contents](#toc)
+
+ - [Description](#section1)
+
+# <a name='description'></a>DESCRIPTION
M src/cap.tcl => src/cap.tcl +9 -0
@@ 1,3 1,9 @@
+#***
+# [manpage_begin cap tclircc 0.0.1]
+# [titledesc {Library cap.tcl}]
+# [description]
+
+
# cap.status:
# - sent (we have sent CAP LS 302, no terminal reply)
# - ack-wait (we've sent off the first REQ, wait for an ACK to update state and send END. will only transition when cap.req-inflight == {})
@@ 314,3 320,6 @@ namespace eval ::cap {
irc::msg send $chan CAP LS 302
}
}
+
+#***
+# [manpage_end]
M src/db/main.tcl => src/db/main.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin db_thread tclircc 0.0.1]
+# [titledesc {Thread tclircc::db}]
+# [description]
+
package require sqlite3
package require logger
@@ 36,3 41,6 @@ proc backup {} {
${log}::info "backup to $backup_dir complete!"
return $backup_dir
}
+
+#***
+# [manpage_end]
M src/irc.tcl => src/irc.tcl +7 -1
@@ 1,4 1,7 @@
-#!/bin/tclsh
+#***
+# [manpage_begin irc tclircc 0.0.1]
+# [titledesc {Library irc.tcl}]
+# [description]
# handler types:
# chan <dispatch> <interp> // irc::listener
@@ 814,3 817,6 @@ namespace eval ::irc {
}
}
}
+
+#***
+# [manpage_end]
M src/irc/main.tcl => src/irc/main.tcl +7 -0
@@ 1,5 1,12 @@
+#***
+# [manpage_begin irc_thread tclircc 0.0.1]
+# [titledesc {Thread tclircc::irc}]
+# [description]
+
package require logger
source [file join $path irc.tcl]
source [file join $path cap.tcl]
+#***
+# [manpage_end]
M src/main.tcl => src/main.tcl +8 -0
@@ 1,5 1,10 @@
#!/bin/env tclsh
+#***
+# [manpage_begin main_thread tclircc 0.0.1]
+# [titledesc {Thread main}]
+# [description]
+
set path [file dirname [dict get [info frame 0] file]]
set version v0.0.1
proc src {file} {
@@ 66,3 71,6 @@ t::exec tclircc::ui {
${log}::info "entering event loop"
vwait nil
+
+#***
+# [manpage_end]
M src/migrate_core.tcl => src/migrate_core.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin migrate_core tclircc 0.0.1]
+# [titledesc {Script migrate_core.tcl}]
+# [description]
+
# TODO: make this more robust maybe
interp create migrator
@@ 49,3 54,6 @@ migrator eval {
${log}::info "core db migrated!"
}
interp delete migrator
+
+#***
+# [manpage_end]
M src/plugins.tcl => src/plugins.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin plugins tclircc 0.0.1]
+# [titledesc {Component plugins.tcl}]
+# [description]
+
package require sha256
# plugin manifest format:
@@ 338,3 343,6 @@ namespace eval plugins {
}
}
+
+#***
+# [manpage_end]
M src/spdx/lib.tcl => src/spdx/lib.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin spdx tclircc 0.0.1]
+# [titledesc {Library spdx/lib.tcl}]
+# [description]
+
namespace eval spdx {
set log [logger::init spdx]
@@ 56,3 61,6 @@ namespace eval spdx {
dict get [set db($id)] see_also
}
}
+
+#***
+# [manpage_end]
M src/threads.tcl => src/threads.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin threads tclircc 0.0.1]
+# [titledesc {Component threads.tcl}]
+# [description]
+
namespace eval threads {
variable threads [list main [thread::id]]
variable log [logger::init tclircc::threads]
@@ 105,3 110,6 @@ namespace eval threads {
::update
}
}
+
+#***
+# [manpage_end]
M src/ui/main.tcl => src/ui/main.tcl +8 -0
@@ 1,3 1,8 @@
+#***
+# [manpage_begin ui_thread tclircc 0.0.1]
+# [titledesc {Thread tclircc::ui}]
+# [description]
+
variable toplevel_count 0
variable toplevel_tabs
variable toplevel_classes
@@ 65,3 70,6 @@ proc mk_toplevel {varname {takefocus 0}} {
}
${log}::debug "ui init done!"
+
+#***
+# [manpage_end]