class HealthCheckCli::Prompt

Constants

PROMPT

Attributes

application_url[RW]
live[RW]

Public Class Methods

new(application_url = 'https://gitlab.com') click to toggle source
# File lib/health_check_cli.rb, line 8
def initialize(application_url = 'https://gitlab.com')
  @application_url = application_url
end

Public Instance Methods

run() click to toggle source
# File lib/health_check_cli.rb, line 14
def run
  @live = true
  puts 'Type `help` for instructions on usage'

  while @live
    begin
      print PROMPT
      args = gets.chomp.split(' ')
      cmd = HealthCheckCli::Commands.find(args.shift, self)
      cmd.execute(args)
    rescue HealthCheckCli::Commands::Error => e
      print "#{e.message}\n"
    end
  end
end
stop() click to toggle source
# File lib/health_check_cli.rb, line 30
def stop
  puts 'Thank you for using health check cli'
  @live = false
end