module Bones::App::Command::ClassMethods

Public Instance Methods

description( *args ) click to toggle source
# File lib/bones/app/command.rb, line 174
def description( *args )
  @description = args.join("\n") unless args.empty?
  @description
end
option( *args, &block ) click to toggle source
# File lib/bones/app/command.rb, line 184
def option( *args, &block )
  args.flatten!
  block = args.pop if block.nil? and Proc === args.last

  if block
    args.each { |val|
      next unless val.instance_of? String
      next unless val =~ /^--(\w+)/

      args << "__#$1"
      define_method(args.last.to_sym, &block)
      options << args
      break
    }
  else
    options << (args.length > 1 ? args : args.first )
  end
end
options() click to toggle source
# File lib/bones/app/command.rb, line 203
def options
  @options ||= []
end
summary( *args ) click to toggle source
# File lib/bones/app/command.rb, line 179
def summary( *args )
  @summary = args.join("\n") unless args.empty?
  @summary
end
synopsis( *args ) click to toggle source
# File lib/bones/app/command.rb, line 169
def synopsis( *args )
  @synopsis = args.join("\n") unless args.empty?
  @synopsis
end