Last active
May 24, 2018 12:14
-
-
Save adamnew123456/59927331017602be8d668a48baeb2992 to your computer and use it in GitHub Desktop.
Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc jdbc_command {options} { | |
set classpath [lindex $options 0] | |
set commands {/usr/bin/java -classpath} | |
lappend commands "/home/chris/Source/jdbcnotebook/target/server-1.0-SNAPSHOT-jar-with-dependencies.jar:$classpath" | |
lappend commands {*}[lrange $options 1 end] | |
return $commands | |
} | |
proc ado_command {options} { | |
set commands {/usr/bin/mono /home/chris/Source/adonotebook/ADONotebook.Server/bin/Debug/Server.exe} | |
lappend commands {*}$options | |
return $commands | |
} | |
set connections { | |
Northwind-ADO | |
{ado -p 1995 -f Mono.Data.Sqlite "Data Source=/home/chris/Northwind_small.sqlite"} | |
Northwind-JDBC | |
{jdbc ":/home/chris/Source/jdbcnotebook/sqlite-jdbc-3.21.0.jar" -p 1996 -j org.sqlite.JDBC "jdbc:sqlite:/home/chris/Northwind_small.sqlite"} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "~/.notebooks.tcl" | |
foreach {name command} $connections { | |
set command_array($name) $command | |
puts "($name) $command" | |
} | |
proc is_valid_choice {name} { | |
global command_array | |
return [info exists command_array($name)] | |
} | |
set current_choice {xxx} | |
while {![is_valid_choice $current_choice]} { | |
puts -nonewline "> " | |
flush stdout | |
set current_choice [gets stdin] | |
} | |
set command_info $command_array($current_choice) | |
set command [lindex $command_info 0] | |
set args [lrange $command_info 1 end] | |
puts "$command ($current_choice): $args" | |
set exec_line [${command}_command $args] | |
exec {*}$exec_line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment