module Clamp::Help
Command
help generation.
Attributes
Public Instance Methods
Source
# File lib/clamp/help.rb, line 34 def derived_usage_description parts = ["[OPTIONS]"] parts += parameters.map(&:name) parts.join(" ") end
Source
# File lib/clamp/help.rb, line 19 def description=(description) @description = description.dup if @description =~ /^\A\n*( +)/ indent = Regexp.last_match(1) @description.gsub!(/^#{indent}/, "") end @description.strip! end
Source
# File lib/clamp/help.rb, line 44 def help(invocation_path, builder = Builder.new) help = builder help.add_usage(invocation_path, usage_descriptions) help.add_description(description) help.add_list(Clamp.message(:parameters_heading), parameters) if has_parameters? help.add_list(Clamp.message(:subcommands_heading), recognised_subcommands) if has_subcommands? help.add_list(Clamp.message(:options_heading), recognised_options) help.string end
Source
# File lib/clamp/help.rb, line 12 def usage(usage) @declared_usage_descriptions ||= [] @declared_usage_descriptions << usage end
Source
# File lib/clamp/help.rb, line 40 def usage_descriptions declared_usage_descriptions || [derived_usage_description] end