class MyCLI

Public Class Methods

exit_on_failure?() click to toggle source
# File bin/devhints, line 9
def self.exit_on_failure?
  true
end

Public Instance Methods

open(thing=nil) click to toggle source
# File bin/devhints, line 14
def open(thing=nil)
  if thing == nil
    Launchy.open "https://devhints.io/"
  else
    response = Net::HTTP.get_response(URI.parse("https://devhints.io/#{thing}"))
    if response.code_type == Net::HTTPNotFound
      puts "! Page not found (https://devhints.io/#{thing})"
      exit 1
    else
      Launchy.open "https://devhints.io/#{thing}"
    end
  end
end
version() click to toggle source
# File bin/devhints, line 29
def version
  begin
    puts "Devhints CLI v#{Gem.loaded_specs["devhints"].version}"
    exit 0
  rescue
    puts "! Devhints CLI: error loading version"
    exit 1
  end
end