vendor/bundle/ruby/1.9.1/gems/thor-0.14.6/lib/thor/task.rb
# Returns the formatted usage by injecting given required arguments
# and required options into the given usage.
Returns the formatted usage by injecting given required arguments
and required options into the given usage.
Returns the formatted usage by injecting given required arguments and required options into the given usage .
def formatted_usage(klass, namespace = true, subcommand = false)
      if namespace
        namespace = klass.namespace
        formatted = "#{namespace.gsub(/^(default)/,'')}:"
        formatted.sub!(/.$/, ' ') if subcommand
      end
      formatted ||= ""
      formatted << if klass && !klass.arguments.empty?
        usage.to_s.gsub(/^#{name}/) do |match|
          match << " " << klass.arguments.map{ |a| a.usage }.compact.join(' ')
        end
      else
        usage.to_s
      end
      formatted << " #{required_options}"
      formatted.strip
    end
def formatted_usage ( klass , namespace = true , subcommand = false ) if namespace namespace = klass . namespace formatted = "#{namespace.gsub(/^(default)/,'')}:" formatted . sub! ( / .$ / , ' ' ) if subcommand end formatted ||= "" formatted << if klass && ! klass . arguments . empty? usage . to_s . gsub ( / ^ #{ name } / ) do | match | match << " " << klass . arguments . map { | a | a . usage } . compact . join ( ' ' ) end else usage . to_s end formatted << " #{required_options}" formatted . strip end
Returns the formatted usage by injecting given required arguments
and required options into the given usage.
Returns the formatted usage by injecting given required arguments and required options into the given usage .
# Add usage with required arguments # Add required options # Strip and go!
klass
<not_specific>
namespace
<not_specific>
subcommand
<not_specific>