class Spty::Command::BaseCommand

Constants

ASCRIPT_PLAYER_DETECT

Check if the application is running

Public Class Methods

running?(show_mesg: true) click to toggle source
# File lib/spty/commands/base_command.rb, line 11
def self.running?(show_mesg: true)
  player_running = Spty::AppleScriptRunner.(ASCRIPT_PLAYER_DETECT)
  return true if player_running.strip == 'Running'

  if show_mesg
    output = "player not running\n"\
             "to launch Spotify player, use: spty launch"

    puts output
  end

  false
end