Class: KBSecret::CLI::Command::Abstract Abstract
- Inherits:
-
Object
- Object
- KBSecret::CLI::Command::Abstract
- Defined in:
- lib/kbsecret/cli/command/abstract.rb
Overview
Direct Known Subclasses
Commands, Conf, Cp, DumpFields, Env, Generator, Generators, Help, List, Login, New, Pass, RawEdit, Rm, Session, Sessions, StashEdit, StashFile, Todo, Types, Version
Instance Attribute Summary collapse
-
#cli ⇒ CLI
readonly
The CLI state corresponding to the command.
Class Method Summary collapse
-
.command_name ⇒ String
The command's CLI-friendly name.
-
.config ⇒ Hash?
The configuration for the command, if any.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Abstract
constructor
A new instance of Abstract.
-
#run! ⇒ Object
abstract
Runs the command.
-
#setup! ⇒ Object
abstract
Sets up any state used by the command.
-
#validate! ⇒ Object
abstract
Runs any validation checks required by the command.
Constructor Details
Instance Attribute Details
#cli ⇒ CLI (readonly)
Returns the CLI state corresponding to the command.
11 12 13 |
# File 'lib/kbsecret/cli/command/abstract.rb', line 11 def cli @cli end |
Class Method Details
.command_name ⇒ String
Returns the command's CLI-friendly name.
16 17 18 19 20 21 |
# File 'lib/kbsecret/cli/command/abstract.rb', line 16 def self.command_name name.split("::") .last .gsub(/([^A-Z])([A-Z]+)/, '\1-\2') .downcase end |
Instance Method Details
#run! ⇒ Object
This method is abstract.
Runs the command. Implemented by children.
50 51 52 |
# File 'lib/kbsecret/cli/command/abstract.rb', line 50 def run! nil end |
#setup! ⇒ Object
This method is abstract.
Sets up any state used by the command. Implemented by children.
38 39 40 |
# File 'lib/kbsecret/cli/command/abstract.rb', line 38 def setup! nil end |
#validate! ⇒ Object
This method is abstract.
Runs any validation checks required by the command. Implemented by children.
44 45 46 |
# File 'lib/kbsecret/cli/command/abstract.rb', line 44 def validate! nil end |