Module: CommandKit::Usage
- Extended by:
- ModuleMethods
- Includes:
- CommandName, Help
- Included in:
- Arguments, Command, Commands, Options::Parser
- Defined in:
- lib/command_kit/usage.rb
Overview
Defines the usage string for a command class.
Examples
include CommandKit::Usage
usage "[options] ARG1 ARG2 [ARG3 ...]"
Defined Under Namespace
Modules: ClassMethods, ModuleMethods
Instance Attribute Summary
Attributes included from CommandName
Instance Method Summary collapse
-
#help ⇒ Object
Prints the usage.
-
#help_usage ⇒ Object
Prints the
usage: ...
output. -
#usage ⇒ Array<String>, ...
Similar to .usage, but prepends command_name.
Methods included from ModuleMethods
Methods included from Help::ModuleMethods
Methods included from CommandName
Methods included from CommandName::ModuleMethods
Instance Method Details
#help ⇒ Object
Prints the usage.
114 115 116 |
# File 'lib/command_kit/usage.rb', line 114 def help help_usage end |
#help_usage ⇒ Object
Prints the usage: ...
output.
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/command_kit/usage.rb', line 94 def help_usage case (usage = self.usage) when Array puts "usage: #{usage[0]}" usage[1..].each do |command| puts " #{command}" end when String puts "usage: #{usage}" end end |
#usage ⇒ Array<String>, ...
Similar to .usage, but prepends command_name.
80 81 82 83 84 85 86 87 |
# File 'lib/command_kit/usage.rb', line 80 def usage case (usage = self.class.usage) when Array usage.map { |command| "#{command_name} #{command}" } when String "#{command_name} #{usage}" end end |