Method not available on this version
This method is only available on newer versions.
The first available version (v2_6_3) is shown here.
formatted_usage(klass, namespace = true, subcommand = false)
public
Returns the formatted usage by injecting given required arguments and
required options into the given usage.
# File lib/bundler/vendor/thor/lib/thor/command.rb, line 41
def formatted_usage(klass, namespace = true, subcommand = false)
if ancestor_name
formatted = "#{ancestor_name} ".dup # add space
elsif namespace
namespace = klass.namespace
formatted = "#{namespace.gsub(/^(default)/, '')}:".dup
end
formatted ||= "#{klass.namespace.split(':').last} ".dup if subcommand
formatted ||= "".dup
# Add usage with required arguments
formatted << if klass && !klass.arguments.empty?
usage.to_s.gsub(/^#{name}/) do |match|
match << " " << klass.arguments.map(&:usage).compact.join(" ")
end
else
usage.to_s
end
# Add required options
formatted << " #{required_options}"
# Strip and go!
formatted.strip
end