module CommandKit::Usage
Defines the usage string for a command class.
## Examples
include CommandKit::Usage usage "[options] ARG1 ARG2 [ARG3 ...]"
Public Instance Methods
help()
click to toggle source
Prints the usage.
@see help_usage
@api public
# File lib/command_kit/usage.rb, line 112 def help help_usage end
help_usage()
click to toggle source
Prints the `usage: …` output.
@api semipublic
# File lib/command_kit/usage.rb, line 92 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()
click to toggle source
Similar to {ClassMethods#usage .usage}, but prepends {CommandName#command_name command_name}.
@return [Array<String>, String, nil]
@api public
# File lib/command_kit/usage.rb, line 78 def usage case (usage = self.class.usage) when Array usage.map { |command| "#{command_name} #{command}" } when String "#{command_name} #{usage}" end end