A command line parser.
Because, lets face it, they all kinda suck some which way or another.
Not that this will be an improvement, just my shot in the dark.
Or what we’ll call examples but is actually ideas for what Power might do…
<pre>
module FooBar
class Runner
def start(port = 8000, interval = 0.01)
aliases :port => :p, :interval => :I
magic
end
end
end
Which could be run with:
<pre>
$ foobar start -p 4890 -I 0.08
</pre>
Then, the binary foobar
would be defined something like this
(possibly):
<pre>
require 'foo_bar'
FooBar::Runner.send(:include, Power)
FooBar::Runner.run!(ARGV)
</pre>
We’d need to use Ruby2Ruby or ParseRuby to figure out the params, plus there
are certain option classes this doesn’t allow for: options without default
values (and those that do have specific types), options that are not
param-based (ie: the name of the app to generate in rails foo
),
etc.
This is all just a random idea…
The name could change. Just had to name it something, you know.
Copyright © 2008 Matt Todd.
Licensed under the MIT license.
TODO: copy license text here or in LICENSE file.