Sha256: 3a4393485b6bae0aedcb054ce5ba600d5399493759c9f88a6223ae9db2cdaef0

Contents?: true

Size: 826 Bytes

Versions: 15

Compression:

Stored size: 826 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_file(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

15 entries across 15 versions & 1 rubygems

Version Path
lolcommits-0.17.2 lib/lolcommits/cli/launcher.rb
lolcommits-0.17.1 lib/lolcommits/cli/launcher.rb
lolcommits-0.17.0 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.5 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.4 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.3 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.2 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.1 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.0 lib/lolcommits/cli/launcher.rb
lolcommits-0.16.0.pre1 lib/lolcommits/cli/launcher.rb
lolcommits-0.15.1 lib/lolcommits/cli/launcher.rb
lolcommits-0.15.0 lib/lolcommits/cli/launcher.rb
lolcommits-0.14.2 lib/lolcommits/cli/launcher.rb
lolcommits-0.14.1 lib/lolcommits/cli/launcher.rb
lolcommits-0.14.0 lib/lolcommits/cli/launcher.rb