Sha256: 66e659428599b5b3966afbb0ffe20338fbf4ed4ec65a626bc1e7d2dfcac80fed

Contents?: true

Size: 343 Bytes

Versions: 7

Compression:

Stored size: 343 Bytes

Contents

require 'launchy'

module CLIUtils
  # Pref Action to open a URL in the default
  # browser.
  class OpenUrlAction < PrefAction
    # Runs the action.
    # @return [void]
    def run
      url = @parameters[:url]
      Launchy.open(url) do |exception|
        fail "Failed to open URL: #{ exception }" if exception
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cliutils-2.2.6 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.5 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.4 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.3 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.2 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.1 lib/cliutils/prefs/pref_actions/open_url_action.rb
cliutils-2.2.0 lib/cliutils/prefs/pref_actions/open_url_action.rb