Class: Hashira::CLI
- Inherits:
-
Object
show all
- Defined in:
- lib/hashira/cli.rb,
lib/hashira/cli/run.rb,
lib/hashira/cli/usage.rb,
lib/hashira/cli/fail_on.rb,
lib/hashira/cli/options.rb,
lib/hashira/cli/command_line.rb
Defined Under Namespace
Modules: FailOn, Usage
Classes: CommandLine, Options, Run
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ CLI
Returns a new instance of CLI.
19
20
21
22
|
# File 'lib/hashira/cli.rb', line 19
def initialize(options)
@options = options
@pipeline = Pipeline.new(Project.detect(options.directories))
end
|
Class Method Details
.report_failure(error) ⇒ Object
14
15
16
17
|
# File 'lib/hashira/cli.rb', line 14
def self.report_failure(error)
warn "hashira: #{error.message}"
1
end
|
.run(argv) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/hashira/cli.rb', line 5
def self.run(argv)
options = Options.parse(argv)
usage?(options) ? Usage.public_send(options.mode) : new(options).run
rescue Error => error
report_failure(error)
end
|
.usage?(options) ⇒ Boolean
12
|
# File 'lib/hashira/cli.rb', line 12
def self.usage?(options) = %i[help version].include?(options.mode)
|
Instance Method Details
#run ⇒ Object
24
|
# File 'lib/hashira/cli.rb', line 24
def run = Run.new(@pipeline, @options).exit_code
|