Class: Hashira::CLI
- Inherits:
-
Object
show all
- Defined in:
- lib/hashira/cli.rb,
lib/hashira/cli/options.rb
Defined Under Namespace
Modules: FailOn, PackageBy, Skip, Usage
Classes: Arguments, CommandLine, Options, Run
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ CLI
Returns a new instance of CLI.
18
19
20
21
|
# File 'lib/hashira/cli.rb', line 18
def initialize(options)
@options = options
@pipeline = options.pipeline
end
|
Class Method Details
.failure(error) ⇒ Object
13
14
15
16
|
# File 'lib/hashira/cli.rb', line 13
def self.failure(error)
warn("hashira: #{error.message}")
1
end
|
.run(argv) ⇒ Object
4
5
6
7
8
9
|
# File 'lib/hashira/cli.rb', line 4
def self.run(argv)
options = Options.parse(argv)
usage?(options) ? Usage.public_send(options.mode) : new(options).run
rescue Hashira::Error => error
failure(error)
end
|
.usage?(options) ⇒ Boolean
11
|
# File 'lib/hashira/cli.rb', line 11
def self.usage?(options) = %i[help version].include?(options.mode)
|
Instance Method Details
#run ⇒ Object
23
|
# File 'lib/hashira/cli.rb', line 23
def run = Run.new(@pipeline, @options).status
|