class Playwright::CLI::Utils::OS::OS

Public Instance Methods

open_editor(path:, name: Pathname.new(path).basename) click to toggle source
# File lib/playwright/cli/utils/os.rb, line 24
def open_editor path:, name: Pathname.new(path).basename
  display.error "#{name} is not a Playwright script!" unless Dir.exists?(path) || File.exists?(path)
  if %x[ $EDITOR #{path} ]
    display.print "Opening #{name} in your default editor..."
  else
    display.error "Failed to open your editor!"
  end
end
open_url(url:, name: URI(url).host) click to toggle source
# File lib/playwright/cli/utils/os.rb, line 16
def open_url url:, name: URI(url).host
  if %x[ #{::OS.open_file_command} #{url} ]
    display.print "Opening #{name} in your default browser..."
  else
    display.error "Failed to open your browser!"
  end
end