I rewrote the merb command to be cleaner, more sane and extendable.
The benefits are:
* a much cleaner command line API
* sets user expectations of what options apply to which commands
* eliminates illogical possibilities, e.g., what happens if a user specifes both --webrick and --fastcgi
* Removal of the convoluted 230-line "parse_args" method
* "commands" such as generate or run-script are clearly differentiated from "options"
* Detailed help is available for each command and subcommand
* Additional commands and subcommands could be added by plugins
* Options and arguments are firmly validated
* merb [project] (the one-arg project generator) still works
* merb (no-arg server starter) still works
---
$ merb --help
Merb Mongrel+ Erb. Lightweight replacement for ActionPack?.
********************************************************************************
If no flags are given, Merb starts in the foreground on port 4000.
********************************************************************************
Usage: merb [global options] COMMAND [options] [arguments]
Available commands:
console Start merb in irb console mode.
generate Generate a fresh merb application or plugin.
application Generate a merb application.
plugin Generate a merb plugin.
help Provide help for individual commands
script Run scripts and/or code in the merb app.
start Start merb application (=default command)
stop Stop merb application
version
Global options:
-M, --merb-config FILENAME This flag is for explicitly declaring the merb app's config file.
-m, --merb-root MERB_ROOT The path to the Merb.root for the app you want to run (default is current working dir).
-f, --config-file FILENAME This flag is for adding extra config files for things like the upload progress module.
-l, --log-level LEVEL Log levels can be set to any of these options: DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
-e, --environment STRING Run merb in the correct mode(development, production, testing)
-h, --help Show help
---
Get help on each command:
---
$ merb help start
start: Start merb application
Start merb application as a single node or a cluster of nodes.
Usage: merb start [options]
Options for start:
-u, --user USER This flag is for having merb run as a user other than the one currently logged in. Note: if you set this you must also provide a --group option for it to take effect.
-G, --group GROUP This flag is for having merb run as a group other than the one currently logged in. Note: if you set this you must also provide a --user option for it to take effect.
-p, --port PORTNUM Port to run merb on, defaults to 4000.
-s, --start-drb PORTNUM This is the port number to run the drb daemon on for sessions and upload progress monitoring.
-A, --adapter RACK_ADAPTER Specify which Rack server adapter to use.
-d, --[no-]daemonize This will run a single merb in the background.
-c, --cluster-nodes NUM_MERBS Number of merb daemons to run.
-h, --host HOSTNAME Host to bind to (default is all IP's).
-D, --debugger Run merb using rDebug.
---
This syntax works for subcommands, and we also get "partial command" capability:
---
$ merb help gen app
application: Generate a merb application.
Generate a fresh merb application.
Usage: merb generate application PATH
---