mdub/clamp — pull request #29 by jwhitley (2013-03-02 01:26:49+00:00)
Title: Support option inheritance for subcommand classes

In clamp 0.5.0, the following example does not work as expected:

```
require 'clamp'

class HelloCommand < Clamp::Command
def execute
puts "hello #{name}"
end
end

class MainCommand < Clamp::Command
option "--name", "NAME", "a name"

subcommand "hello", "Say hello", HelloCommand
end

MainCommand.run(File.basename($0), %w[hello --name ed])
```

It produces the error:

```
ERROR: Unrecognised option '--name'

See: 'clamp_example.rb hello --help'`
```

The example code is also available at [this gist](https://gist.github.com/jwhitley/750ea669fd98a9e79d5a).

The changes in this PR add tests for the above case, and modify clamp to support this case. The most notable structural change is that Attributes now store any block passed to instances. That is necessary as Clamp::Option::Declaration#effective_options now defines accessors in a deferred manner so that parent command options work correctly on subcommands.