[ditz-talk] Some work on ditz

Ohad Lutzky ohad at lutzky.net
Wed Jul 30 17:33:42 EDT 2008


On Thu, Jul 31, 2008 at 12:33 AM, Ohad Lutzky <ohad at lutzky.net> wrote:
> On Wed, Jul 30, 2008 at 11:25 PM, William Morgan
> <wmorgan-ditz at masanjin.net> wrote:
>> Reformatted excerpts from Ohad Lutzky's message of 2008-07-29:
>>> So - other ideas? Elucidate away :)
>>
>> Looking at your branch, you have exactly the new syntax for
>> Operator#operation that I wanted:
>>
>>  -  operation :help, "List all registered commands", :maybe_command
>>  -  def help project, config, command
>>  +  operation :help, "List all registered commands", :maybe_command do
>>  +    opt :cow, "Activate super cow powers", :default => false
>>  +  end
>>  +  def help project, config, opts, command
>>
>> So, nice work.
>
> Hurray! :)
>
>> I'm also considering the idea of having opts just merge with config, so
>> the command only has one source of options. Unless there's a real reason
>> for the command to distinguish between global and command-specific
>> options. Thoughts?
>
> Well, config is currently a custom object (why, by the way?), whereas
> trollop just gives us a hash. It would be possible to merge them,
> manually adding fields for anything we need, but I'm not sure what
> we'd gain.
>
>> The only other comment I have is that instead of replacing args with
>> ARGV everywhere in operator.rb, I'd prefer you just pass ARGV to
>> Operator#do in bin/ditz. That way Operator is insulated from where its
>> arguments actually came from. (You can imagine other uses that don't
>> involve ARGV.) Since all gets calls are now called on $stdin explicitly,
>> it shouldn't be a problem to just pass ARGV around.
>
> This would work if trollop weren't hardwired to work with ARGV.
> However, currently Trollop's "options" sends all of his parameters on
> to Trollop::Parser.initialize, which in turn passes them to cloaker,
> and I have no idea what that does :)
>
> --
> Man is the only animal that laughs and weeps, for he is the only
> animal that is struck with the difference between what things are and
> what they ought to be.
>  - William Hazlitt
>
> Ohad Lutzky
>



-- 
Man is the only animal that laughs and weeps, for he is the only
animal that is struck with the difference between what things are and
what they ought to be.
 - William Hazlitt

Ohad Lutzky


More information about the ditz-talk mailing list