unnali/rouge — pull request #20 by noprompt (2012-12-12 07:47:57+00:00)
Title: Major refactoring of rouge binary and Rouge::REPL

Basically I leveraged Ruby's `OptionParser` and moved `ARGV` handling in to the binary. I also added options `-e` , for evaluating a string argument, `-v` for the version information, and `--[no-]backtrace` for enabling or disabling backtracing. The door has also been left open for further options to the REPL.

Oh, and the version number is also printed when running the REPL as in Clojure - hope that's cool.

```shell
# Print version information with -v or --version
$ bin/rouge -v
Rouge 0.0.5

# Evaluate a string with -e or --eval
$ bin/rouge -e "(puts (+ 1 2))"
3

# Print Rouge boot time
$ bin/rouge --time-startup
0.622079

# Get help with -h or --help (provided by OptionParser)
$ bin/rouge -h
rouge [switch] [filename]
-v, --version Print version number
-e, --eval STR Evaluate the contents of STR
--time-startup Report boot up time
--[no-]backtrace Enable/disable backtracing in REPL

# Run the Rouge REPL (including version information upon initialization).
$ bin/rouge
Rouge 0.0.5
user=>
#...

# Disable backtracing (but it's on by default).
$ bin/rouge --no-backtrace
Rouge 0.0.5
user=> trash
!! Rouge::Namespace::VarNotFoundError: trash
user=>
#...
```

In the future it would be really awesome to have the Rouge binary handle stuff like `rouge file.rg arg1 arg2` and have the arguments available to the script.