Class: DbAgile::Command::Help
- Inherits:
-
DbAgile::Command
- Object
- DbAgile::Command
- DbAgile::Command::Help
- Defined in:
- lib/dbagile/command/help.rb
Overview
Show help of a given command
Usage: dba ##command_name COMMAND
Constant Summary
Constants inherited from DbAgile::Command
Instance Attribute Summary collapse
-
#command ⇒ Object
Command name.
Attributes inherited from DbAgile::Command
Attributes included from ClassMethods
#description, #summary, #usage
Instance Method Summary collapse
-
#execute_command ⇒ Object
Executes the command.
-
#normalize_pending_arguments(arguments) ⇒ Object
Normalizes the pending arguments.
Methods inherited from DbAgile::Command
#add_options, #category, #check_command, #command_name, #description, #initialize, #options, #run, #set_default_options, #show_help, #summary, #unsecure_run, #usage
Methods included from ClassMethods
#build_command_options, #build_me, #category, #command_for, #command_name, #command_name_of, #each_subclass, #inherited, #ruby_method_for, #subclasses
Methods included from Robust
#ambigous_argument_list!, #assumption_error!, #bad_argument_list!, #has_command!, #is_in!, #valid_argument_list!, #valid_read_file!
Methods included from DbAgile::Core::IO::Robustness
#has_database!, #valid_database_name!, #valid_database_uri!, #valid_schema_files!
Constructor Details
This class inherits a constructor from DbAgile::Command
Instance Attribute Details
#command ⇒ Object
Command name
12 13 14 |
# File 'lib/dbagile/command/help.rb', line 12 def command @command end |
Instance Method Details
#execute_command ⇒ Object
Executes the command
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dbagile/command/help.rb', line 21 def execute_command flush(command.usage) flush("\n") # flush("Description:") flush("") flush(" " + command.summary) # = command..summarize unless .empty? flush(.join) flush("\n") else flush("\n") end # description = command.description.to_s if description.strip.empty? flush("Sorry, no more information available yet") else flush("Detailed documentation:") flush("") flush(description.gsub(/^/, " ")) flush("") end end |
#normalize_pending_arguments(arguments) ⇒ Object
Normalizes the pending arguments
15 16 17 18 |
# File 'lib/dbagile/command/help.rb', line 15 def normalize_pending_arguments(arguments) self.command = valid_argument_list!(arguments, String) self.command = has_command!(self.command, environment) end |