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::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), inflector: Dry::Inflector.new, **opts) ⇒ Object
Returns a new command.
Instance Method Summary collapse
-
#initialize(out:, err:, fs:, inflector:) ⇒ Command
constructor
Returns a new command.
Constructor Details
#initialize(out:, err:, fs:, inflector:) ⇒ 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.
49 50 51 52 53 54 55 |
# File 'lib/hanami/cli/command.rb', line 49 def initialize(out:, err:, fs:, inflector:) super() @out = out @err = err @fs = fs @inflector = inflector end |
Class Method Details
.new(out: $stdout, err: $stderr, fs: Hanami::CLI::Files.new(out: out), inflector: Dry::Inflector.new, **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 31 |
# File 'lib/hanami/cli/command.rb', line 23 def self.new( out: $stdout, err: $stderr, fs: Hanami::CLI::Files.new(out: out), inflector: Dry::Inflector.new, **opts ) super end |