def create_default_commands
command :help do |c|
c.syntax = 'rhc help <command>'
c.description = 'Display global or <command> help documentation.'
c.when_called do |args, options|
cmd = (1..args.length).reverse_each.map{ |n| args[0,n].join(' ') }.find{ |cmd| command_exists?(cmd) }
if args.empty?
say help_formatter.render
elsif cmd.nil?
RHC::Helpers.error "The command '#{program :name} #{provided_arguments.join(' ')}' is not recognized.\n"
say "See '#{program :name} help' for a list of valid commands."
next
else
command = command(cmd)
help_bindings = CommandHelpBindings.new command, commands, self
say help_formatter.render_command help_bindings
end
end
end
end