-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·43 lines (35 loc) · 981 Bytes
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# the next line restarts using tclkit \
exec tclkit "$0" ${1+"$@"}
source "packages/db_app.tcl"
# Save the original one so we can chain to it:
rename unknown _original_unknown
# Provide own implementation:
proc unknown args {
set name [lindex $args 0]
set arguments [lindex $args 1]
#puts $args
if {![::db_app::has_procedure $name]} {
::db_app::insert_example_procedures
# puts stderr "No ::main procedure in db."
# exit 1
}
::db_app::load_procedure $name
eval $name $arguments
}
proc load_package {name version} {
# append current dir to find packages
lappend auto_path [pwd]
package ifneeded $name $version [list source [file join [pwd] "packages" "$name.tcl"]]
}
package unknown load_package
package require LOL 1.0.0
#::LOL::test
proc init {name} {
# defined in file:
::db_app::create_procedures_table
# defined in sqlite db:
::main $name
}
set name [expr {[llength $argv] == 0 ? "World" : [lindex $argv 0]}]
init $name