Sha256: ea5cf560c4a3adbdb77c1f014bd75fa8a90c2abfb8ad4a5ea24314bcec8fa22a
Contents?: true
Size: 828 Bytes
Versions: 13
Compression:
Stored size: 828 Bytes
Contents
require 'relish/commands/dsl/context_class' require 'relish/commands/dsl/option' require 'relish/commands/dsl/command' require 'relish/commands/dsl/help_text' module Relish module Command module Dsl def option(name, options = {}) Option.new(self).define(name, options) Option.names << name.to_s end def usage(text) HelpText.next_usage = text end def desc(*text) HelpText.next_description = text.join("\n") end def command(arg, &block) case arg when Hash name, alias_target = arg.to_a.flatten block = lambda { self.send(alias_target) } when Symbol name = arg else raise ArgumentError end Command.new(self).define(name, &block) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems