Class: AvoCli::CLI::Commands::BaseCommand

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/avo_cli/cli.rb

Direct Known Subclasses

Lint, Version

Instance Method Summary collapse

Instance Method Details

#halt(message: nil) ⇒ Object



15
16
17
18
19
# File 'lib/avo_cli/cli.rb', line 15

def halt(message: nil)
  message ||= "#{self.class} failed."
  yell message
  exit
end

#run(command) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/avo_cli/cli.rb', line 7

def run(command)
  result = cmd.run(command)
  halt if result.failed?
  result
rescue TTY::Command::ExitError
  halt
end