Class: CueSnap::CLI

Inherits:
Object
  • Object
show all
Includes:
Methadone::CLILogging, Methadone::Main
Defined in:
lib/cuesnap/cli.rb

Class Method Summary collapse

Class Method Details

.command_accessible?(cmd) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
# File 'lib/cuesnap/cli.rb', line 52

def self.command_accessible?(cmd)
    # Passing an empty block allows us to get the status as the return value.
    status = Open4::popen4("sh") do |pid, stdin, stdout, stderr|
      stdin.puts "which #{cmd}"
      stdin.close
    end
    # A 141 exit status means which succeeded.
    status.exitstatus == 141
end

.file_not_found(file) ⇒ Object



48
49
50
# File 'lib/cuesnap/cli.rb', line 48

def self.file_not_found(file)
  help_now! "I looked for #{file}, but didn't find it."
end