File: launchy.rb

package info (click to toggle)
ruby-launchy-shim 2.3.0.1%2Bnmu1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 40 kB
  • sloc: ruby: 37; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 306 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Launchy
  def self.open(uri, options = {})
    if xdg_open_available
      system('xdg-open', uri)
    else
      puts "W: can't open #{uri} without xdg-open; install the `xdg-utils` package!"
    end
  end

  private

  def self.xdg_open_available
    system('which xdg-open >/dev/null')
  end
end