class S3Antivirus::Command
Public Class Methods
command_help(shell, command_name)
click to toggle source
Override command_help
to include the description at the top of the long_description.
Calls superclass method
# File lib/s3_antivirus/command.rb, line 48 def command_help(shell, command_name) meth = normalize_command_name(command_name) command = all_commands[meth] alter_command_description(command) super end
dispatch(m, args, options, config)
click to toggle source
Calls superclass method
# File lib/s3_antivirus/command.rb, line 19 def dispatch(m, args, options, config) # Allow calling for help via: # s3-antivirus command help # s3-antivirus command -h # s3-antivirus command --help # s3-antivirus command -D # # as well thor's normal way: # # s3-antivirus help command help_flags = Thor::HELP_MAPPINGS + ["help"] if args.length > 1 && !(args & help_flags).empty? args -= help_flags args.insert(-2, "help") end # s3-antivirus version # s3-antivirus --version # s3-antivirus -v version_flags = ["--version", "-v"] if args.length == 1 && !(args & version_flags).empty? args = ["version"] end super end
website()
click to toggle source
meant to be overriden
# File lib/s3_antivirus/command.rb, line 77 def website "" end
Private Class Methods
alter_command_description(command)
click to toggle source
# File lib/s3_antivirus/command.rb, line 55 def alter_command_description(command) return unless command # Add description to beginning of long_description long_desc = if command.long_description "#{command.description}\n\n#{command.long_description}" else command.description end # add reference url to end of the long_description unless website.empty? full_command = [command.ancestor_name, command.name].compact.join('-') url = "#{website}/reference/s3-antivirus-#{full_command}" long_desc += "\n\nHelp also available at: #{url}" end command.long_description = long_desc end