Class: Hanami::CLI::Command
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Hanami::CLI::Command
- Defined in:
- lib/hanami/cli/command.rb
Overview
Base class for hanami CLI commands.
Direct Known Subclasses
Hanami::CLI::Commands::App::Command, Hanami::CLI::Commands::App::Middleware, Hanami::CLI::Commands::App::Routes, Hanami::CLI::Commands::App::Run, Hanami::CLI::Commands::App::Server, Hanami::CLI::Commands::Gem::New, Hanami::CLI::Commands::Gem::Version
Class Method Summary collapse
-
.new(out: $stdout, err: $stderr, fs: Hanami::CLI::Files.new(out: out), **opts) ⇒ Object
Returns a new command.
Instance Method Summary collapse
- #inflector ⇒ Object
-
#initialize(out:, err:, fs:) ⇒ Command
constructor
Returns a new command.
Constructor Details
#initialize(out:, err:, fs:) ⇒ Command
Returns a new command.
This method does not need to be called directly when creating commands for the CLI. Commands
are registered as classes, and the CLI framework will initialize the command when needed.
This means that all parameters for #initialize should also be given default arguments. See
new for the standard default arguments for all commands.
48 49 50 51 52 53 |
# File 'lib/hanami/cli/command.rb', line 48 def initialize(out:, err:, fs:) super() @out = out @err = err @fs = fs end |
Class Method Details
.new(out: $stdout, err: $stderr, fs: Hanami::CLI::Files.new(out: out), **opts) ⇒ Object
Returns a new command.
Provides default values so they can be available to any subclasses defining their own #initialize methods.
23 24 25 26 27 28 29 30 |
# File 'lib/hanami/cli/command.rb', line 23 def self.new( out: $stdout, err: $stderr, fs: Hanami::CLI::Files.new(out: out), **opts ) super end |
Instance Method Details
#inflector ⇒ Object
55 56 57 |
# File 'lib/hanami/cli/command.rb', line 55 def inflector @inflector ||= Dry::Inflector.new end |