Sha256: cd5aacd0b5e7ff237ac636ad08de7879137df2b491b946a60d8c2af17021f585
Contents?: true
Size: 673 Bytes
Versions: 7
Compression:
Stored size: 673 Bytes
Contents
require "delegate" class Bard::CLI::Command < SimpleDelegator def self.desc command, description @command = command @method = command.split(" ").first.to_sym @description = description end def self.option *args, **kwargs @option_args = args @option_kwargs = kwargs end def self.setup cli cli.desc @command, @description cli.option *@option_args, **@option_kwargs if @option_args || @option_kwargs # put in local variables so next block can capture it command_class = self method = @method cli.define_method method do |*args| command = command_class.new(self) command.send method, *args end end end
Version data entries
7 entries across 7 versions & 1 rubygems