method
print_options
v2_6_3 -
Show latest stable
- Class:
Bundler::Thor::Base::ClassMethods
print_options(shell, options, group_name = nil)protected
Receives a set of options and print them.
# File lib/bundler/vendor/thor/lib/thor/base.rb, line 533
def print_options(shell, options, group_name = nil)
return if options.empty?
list = []
padding = options.map { |o| o.aliases.size }.max.to_i * 4
options.each do |option|
next if option.hide
item = [option.usage(padding)]
item.push(option.description ? "# #{option.description}" : "")
list << item
list << ["", "# Default: #{option.default}"] if option.show_default?
list << ["", "# Possible values: #{option.enum.join(', ')}"] if option.enum
end
shell.say(group_name ? "#{group_name} options:" : "Options:")
shell.print_table(list, :indent => 2)
shell.say ""
end Related methods
- Instance methods
- all_commands
- all_tasks
- argument
- arguments
- attr_accessor
- attr_reader
- attr_writer
- check_default_type
- check_default_type!
- check_default_type?
- check_unknown_options
- check_unknown_options!
- check_unknown_options?
- class_option
- class_options
- commands
- disable_required_check?
- group
- handle_argument_error
- handle_no_command_error
- handle_no_task_error
- namespace
- no_commands
- no_tasks
- public_command
- public_task
- remove_argument
- remove_class_option
- remove_command
- remove_task
- start
- stop_on_unknown_option?
- strict_args_position
- strict_args_position!
- strict_args_position?
- tasks
- Protected methods
-
baseclass -
basename -
build_option -
build_options -
class_options_help -
create_command -
create_task -
dispatch -
exit_on_failure? -
find_and_refresh_command -
find_and_refresh_task -
from_superclass -
inherited -
initialize_added -
is_thor_reserved_word? -
method_added -
print_options