Class: Ronin::Core::CLI::CommandShell::Command
- Inherits:
-
Object
- Object
- Ronin::Core::CLI::CommandShell::Command
- Defined in:
- lib/ronin/core/cli/command_shell/command.rb
Overview
Represents a defined command within a Ronin::Core::CLI::CommandShell class.
Instance Attribute Summary collapse
-
#completions ⇒ Array<String>, ...
readonly
Possible tab completion values for the command's arguments.
-
#help ⇒ String
readonly
The command's multi-line help output.
-
#method_name ⇒ Symbol
readonly
The command's method name.
-
#name ⇒ Symbol
readonly
The command's name.
-
#summary ⇒ String
readonly
The command's one-line summary.
-
#usage ⇒ String?
readonly
The usage string for the command's arguments.
Instance Method Summary collapse
-
#initialize(name, method_name: name, usage: nil, completions: nil, summary:, help: summary) ⇒ Command
constructor
Initializes a command value object.
-
#to_s ⇒ String
Converts the command to a String.
Constructor Details
#initialize(name, method_name: name, usage: nil, completions: nil, summary:, help: summary) ⇒ Command
Initializes a command value object.
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 82 def initialize(name, method_name: name, usage: nil, completions: nil, summary: , help: summary) @name = name @method_name = method_name @usage = usage @summary = summary @help = help @completions = completions end |
Instance Attribute Details
#completions ⇒ Array<String>, ... (readonly)
Possible tab completion values for the command's arguments.
48 49 50 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 48 def completions @completions end |
#help ⇒ String (readonly)
The command's multi-line help output.
58 59 60 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 58 def help @help end |
#method_name ⇒ Symbol (readonly)
The command's method name.
38 39 40 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 38 def method_name @method_name end |
#name ⇒ Symbol (readonly)
The command's name.
33 34 35 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 33 def name @name end |
#summary ⇒ String (readonly)
The command's one-line summary.
53 54 55 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 53 def summary @summary end |
#usage ⇒ String? (readonly)
The usage string for the command's arguments.
43 44 45 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 43 def usage @usage end |
Instance Method Details
#to_s ⇒ String
Converts the command to a String.
101 102 103 104 105 106 107 |
# File 'lib/ronin/core/cli/command_shell/command.rb', line 101 def to_s if @usage "#{@name} #{@usage}" else @name.to_s end end |