Module: CommandKit::Examples
- Extended by:
- ModuleMethods
- Includes:
- CommandName, Help
- Included in:
- Command
- Defined in:
- lib/command_kit/examples.rb
Overview
Allows defining example commands for the command class.
Examples
include CommandKit::Examples
examples [
"my_cmd -o output.txt path/to/file"
]
Defined Under Namespace
Modules: ClassMethods, ModuleMethods
Instance Attribute Summary
Attributes included from CommandName
Instance Method Summary collapse
- #examples ⇒ Object
-
#help ⇒ Object
Calls the superclass'es
#help
method, if it's defined, then calls #help_examples. -
#help_examples ⇒ Object
Prints the command class'es example commands.
Methods included from ModuleMethods
Methods included from CommandName
Methods included from CommandName::ModuleMethods
Methods included from Help::ModuleMethods
Instance Method Details
#examples ⇒ Object
83 84 85 |
# File 'lib/command_kit/examples.rb', line 83 def examples self.class.examples end |
#help ⇒ Object
Calls the superclass'es #help
method, if it's defined, then calls
#help_examples.
108 109 110 111 112 |
# File 'lib/command_kit/examples.rb', line 108 def help super help_examples end |
#help_examples ⇒ Object
Prints the command class'es example commands.
92 93 94 95 96 97 98 99 100 |
# File 'lib/command_kit/examples.rb', line 92 def help_examples if (examples = self.examples) puts puts "Examples:" examples.each do |command| puts " #{command_name} #{command}" end end end |