#170 Fan shell

brian Wed 2 Jan 2008

I've added a new tool called "fansh" which is a simple interactive command line shell. You can type in any expression or statement and it will print the result. If you declare a local variable, you can use it subsequent expressions. You can dump the variables via the "scope" command. The shell isn't yet anywhere as sophisticated as most other languages - you can't enter anything but a single line statement or expression. But still it is immensely useful for trying things out quickly:

Fan Shell v1.0.19 ('?' for help)
fansh> x := ["one", "two", "three", "four"]
[one, two, three, four]
fansh> x.sort
[four, one, three, two]
fansh> x.type
sys::Str[]
fansh> x.type.params
[V:sys::Str, L:sys::Str[]]
fansh> c := sql::Connection.open("jdbc:mysql://localhost:3306/sql_test", "root", "")
fan.sql.Connection@dc67e
fansh> c.listTables
[farmers]
fansh> c.close
true
fansh> scope

Current Scope:
  sys::Str[] x = [four, one, three, two]
  sql::Connection c = fan.sql.Connection@dc67e

fansh> quit

Login or Signup to reply.