Sha256: f6376a05acc0b80dedcab9fe1d6a5caab7e8a343a2d70833878fd06df372e5a0

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

# frozen_string_literal: true

require 'launchy'

module Lolcommits
  module CLI
    # Helper class for wrapping the opening of files on the desktop in a
    # cross-platform way.
    #
    # Right now this is mostly just a wrapper for Launchy, in case we want
    # to factor out it's dependency later or swap it out.
    class Launcher
      def self.open_image(path)
        open_with_launchy(path)
      end

      def self.open_folder(path)
        open_with_launchy(path)
      end

      def self.open_url(url)
        open_with_launchy(url)
      end

      # Opens with Launchy, which knows how to open pretty much anything
      # local files, urls, etc.
      #
      # Private so we replace it later easier if we want.
      def self.open_with_launchy(thing)
        Launchy.open(thing)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lolcommits-0.13.1 lib/lolcommits/cli/launcher.rb
lolcommits-0.13.0 lib/lolcommits/cli/launcher.rb