searchlink 2.3.68 → 2.3.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bb82b5a1651a62b1e08835d66262ba2c7f14a1549645bdfa30f6a182dbfb4f1
4
- data.tar.gz: e2e5f2f4585673720b2e54c86b30c73a900f2fe9405ae27668368d62543c4d40
3
+ metadata.gz: 94434b4c63f4188ca00e93ad4c2be7765b61a2fdbccd3b7e706482bf1e09b618
4
+ data.tar.gz: 4af48f283d1a693bed323cdbbb91121ee5b4616225d4ecef46f80302016227ff
5
5
  SHA512:
6
- metadata.gz: 80c086ce264c18182ddad89a8b7c8a677b32d685232d571736e767c3fb4f27bc43451c0ab32ba2e68d5a6d0e4226a7634346833875759994fc921b807678d194
7
- data.tar.gz: a00fdb7d2371b187e2a1159bd48cade34fe53f0fcf14dd0b1fbb4948e35a17303aab5ea47779d790769bbe70497897b68ff83015f088a7e480f923be42c3c0f9
6
+ metadata.gz: 3fa2094dbbf341680baefae73f98aba890ace10c6f6d44198b7902c28810b9e3cc8121199b9ba26a1da0243dcf779c3f018ebaaa6f1e794456d72106fafe5ad6
7
+ data.tar.gz: 7a39a40fbc8e8466c3652e236eee03091b027dd83aebd481b31dcb3acaa3a53124d362887d4cbe33bc22699fadd4e7adfe40f4f40db48cb8f69754584d84ae70
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SL
4
+ # Custom Semantic Versioning error
5
+ class VersionError < StandardError
6
+ def initialize(msg)
7
+ msg = msg ? ": #{msg}" : ''
8
+ puts "Versioning error#{msg}"
9
+
10
+ super()
11
+
12
+ Process.exit 1
13
+ end
14
+ end
15
+
16
+ # Custom plugin error
17
+ class PluginError < StandardError
18
+ def initialize(msg = nil, plugin: nil)
19
+ plugin = %("#{plugin}") if plugin
20
+ plugin ||= 'plugin'
21
+ msg = ": #{msg}" if msg
22
+ puts "Error in #{plugin}#{msg}"
23
+
24
+ super()
25
+
26
+ Process.exit 1
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ::Float
4
+ def to_datetime
5
+ DateTime.parse(Time.at(self).to_s).next_year(31)
6
+ end
7
+ end
8
+
9
+ class ::Integer
10
+ def to_datetime
11
+ DateTime.parse(Time.at(self).to_s).next_year(31)
12
+ end
13
+ end
@@ -62,13 +62,16 @@ module SL
62
62
 
63
63
  # Posts macOS notifications
64
64
  #
65
- # @param str The title of the notification
66
- # @param sub The text of the notification
65
+ # @param title [String] The title of the notification
66
+ # @param subtitle [String] The text of the notification
67
67
  #
68
- def notify(str, sub)
68
+ def notify(title, subtitle)
69
69
  return unless SL.config['notifications']
70
70
 
71
- `osascript -e 'display notification "SearchLink" with title "#{str}" subtitle "#{sub}"'`
71
+ title = title.gsub(/"/, '\\"')
72
+ subtitle = subtitle.gsub(/"/, '\\"')
73
+
74
+ `osascript -e 'display notification "SearchLink" with title "#{title}" subtitle "#{subtitle}"'`
72
75
  end
73
76
  end
74
77
  end