icalPal 1.1.3 → 1.1.4
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 +4 -4
- data/README.md +4 -2
- data/bin/icalPal +22 -17
- data/icalPal.gemspec +4 -2
- data/lib/defaults.rb +1 -1
- data/lib/event.rb +17 -6
- data/lib/options.rb +1 -1
- metadata +23 -34
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c83cdb34723fcb8765291ee5724c3a3521d32aa268649631b2ae6e0d597c13
|
4
|
+
data.tar.gz: 54c399338c62d6ee482ad5240ede35b0b86b7d796320ec95bc6076485e672365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d284b817b3c49f1db9ca67920ccced88a4b0c1247b3137a590568f388b60f9b5e79af493cc16f6384a7d7ae09de16f3e578851cf184df9bcc16e8bf8ab8bef53
|
7
|
+
data.tar.gz: 716a3c40617e47413ce661157e0bface4671b0b400b1fad3f4bdf0b084d1fc4a9c75f88dfb05a89928749355cce56984692c6e740fd196820a8cb03f06c643aa
|
data/README.md
CHANGED
@@ -181,7 +181,9 @@ to mimic icalBuddy as much as possible.
|
|
181
181
|
CSV, Hash, JSON, and YAML print all fields for all items in their
|
182
182
|
respective formats. From that you can analyze the results any way you like.
|
183
183
|
|
184
|
-
|
184
|
+
Remind format uses a minimal implementation built in icalPal.
|
185
|
+
|
186
|
+
Other formats such as ANSI, HTML, Markdown, RDoc, and TOC, use Ruby's
|
185
187
|
[RDoc::Markup](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup.html)
|
186
188
|
framework to build and render the items.
|
187
189
|
|
@@ -207,5 +209,5 @@ objects, one for each of the item's properties:
|
|
207
209
|
|
208
210
|
The document will also include a number of
|
209
211
|
[RDoc::Markup::Verbatim](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup/Verbatim.html)
|
210
|
-
items.
|
212
|
+
items. They are not included in the output, but are used to pass
|
211
213
|
information about the item and property to the default formatter.
|
data/bin/icalPal
CHANGED
@@ -40,8 +40,10 @@ $log.info("Options: #{$opts}")
|
|
40
40
|
# Add an item to the list
|
41
41
|
#
|
42
42
|
# @param item[Object]
|
43
|
+
|
43
44
|
def add(item)
|
44
|
-
$log.
|
45
|
+
$log.info("Adding #{item.inspect} #{item['UUID']} (#{item['title']})") if item['UUID']
|
46
|
+
|
45
47
|
item['sday'] = ICalPal::RDT.new(*item['sdate'].to_a[0..2]) if item['sdate']
|
46
48
|
$items.push(item)
|
47
49
|
end
|
@@ -117,6 +119,7 @@ end
|
|
117
119
|
begin
|
118
120
|
$items.sort_by! { |i| [ i[$opts[:sep]], i[$opts[:sort]], i['sdate'] ] }
|
119
121
|
$items.reverse! if $opts[:reverse]
|
122
|
+
$items.uniq!
|
120
123
|
rescue ArgumentError => e
|
121
124
|
$log.warn("Sorting failed, results may be unexpected\n")
|
122
125
|
end
|
@@ -143,22 +146,24 @@ items = $items[0..$opts[:li] - 1]
|
|
143
146
|
|
144
147
|
unless mu
|
145
148
|
puts case $opts[:output]
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
149
|
+
when 'csv' then
|
150
|
+
o = {
|
151
|
+
headers: items[0].keys,
|
152
|
+
write_converters: proc { |f| f.respond_to?(:gsub)? f.gsub(/\n/, '\n') : f },
|
153
|
+
write_headers: true,
|
154
|
+
}
|
155
|
+
|
156
|
+
CSV.generate(o) { |k| items.each { |i| k << i.values.map { |v| v.to_s } } }
|
157
|
+
when 'hash' then items.map { |i| i.self }
|
158
|
+
when 'json' then items.map { |i| i.self }.to_json
|
159
|
+
when 'yaml' then items.map { |i| i.self }.to_yaml
|
160
|
+
when 'remind' then items.map { |i|
|
161
|
+
"REM #{i['sdate'].strftime('%F AT %R')} " +
|
162
|
+
"DURATION #{((i['edate'] - i['sdate']).to_f * 1440).to_i } " +
|
163
|
+
"MSG #{i['title']}"
|
164
|
+
}.join("\n")
|
165
|
+
else abort "No formatter for #{$opts[:output]}"
|
166
|
+
end
|
162
167
|
|
163
168
|
exit
|
164
169
|
end
|
data/icalPal.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "icalPal"
|
3
|
-
s.version = "1.1.
|
3
|
+
s.version = "1.1.4"
|
4
4
|
s.summary = "Command-line tool to query the macOS Calendar"
|
5
5
|
s.description = <<-EOF
|
6
6
|
Inspired by icalBuddy and maintains close compatability. Includes
|
@@ -10,12 +10,14 @@ EOF
|
|
10
10
|
s.authors = "Andy Rosen"
|
11
11
|
s.email = "ajr@corp.mlfs.org"
|
12
12
|
s.homepage = "https://github.com/ajrosen/#{s.name}"
|
13
|
-
s.licenses = [ "GPL-3.0
|
13
|
+
s.licenses = [ "GPL-3.0-or-later" ]
|
14
14
|
|
15
15
|
s.files = Dir[ "#{s.name}.gemspec", "bin/*", "lib/*.rb" ]
|
16
16
|
s.executables = [ "#{s.name}" ]
|
17
17
|
s.extra_rdoc_files = [ "README.md" ]
|
18
18
|
|
19
|
+
s.add_runtime_dependency "sqlite3", "~> 1"
|
20
|
+
|
19
21
|
s.bindir = 'bin'
|
20
22
|
s.required_ruby_version = '>= 2.6.0'
|
21
23
|
end
|
data/lib/defaults.rb
CHANGED
data/lib/event.rb
CHANGED
@@ -3,6 +3,11 @@ module ICalPal
|
|
3
3
|
class Event
|
4
4
|
include ICalPal
|
5
5
|
|
6
|
+
def []=(k, v)
|
7
|
+
@self[k] = v
|
8
|
+
@self['sday'] = ICalPal::RDT.new(*self['sdate'].to_a[0..2]) if k == 'sdate'
|
9
|
+
end
|
10
|
+
|
6
11
|
# Standard accessor with special handling for +age+,
|
7
12
|
# +availability+, +datetime+, +location+, +notes+, +status+,
|
8
13
|
# +title+, and +uid+
|
@@ -35,6 +40,9 @@ module ICalPal
|
|
35
40
|
when 'notes' then # \n -> :nnr
|
36
41
|
@self['notes']? @self['notes'].strip.gsub(/\n/, $opts[:nnr]) : nil
|
37
42
|
|
43
|
+
when 'sday' then # pseudo-property
|
44
|
+
ICalPal::RDT.new(*@self['sdate'].to_a[0..2])
|
45
|
+
|
38
46
|
when 'status' then # Integer -> String
|
39
47
|
EventKit::EKEventStatus.select { |k, v| v == @self['status'] }.keys[0]
|
40
48
|
|
@@ -77,14 +85,15 @@ module ICalPal
|
|
77
85
|
@self["#{k[0]}date"] = RDT.new(*t.to_a.reverse[4..], t.zone) if t
|
78
86
|
end
|
79
87
|
|
80
|
-
obj['type'] = EventKit::EKSourceType.find_index { |i| i[:name] == 'Subscribed' } if obj['subcal_url']
|
81
|
-
type = EventKit::EKSourceType[obj['type']]
|
82
|
-
|
83
88
|
if @self['start_tz'] == '_float'
|
84
89
|
@self['sdate'] = RDT.new(*(@self['sdate'].to_time - Time.zone_offset($now.zone())).to_a.reverse[4..], $now.zone)
|
85
90
|
@self['edate'] = RDT.new(*(@self['edate'].to_time - Time.zone_offset($now.zone())).to_a.reverse[4..], $now.zone)
|
86
91
|
end
|
87
92
|
|
93
|
+
# Type of calendar event is from
|
94
|
+
obj['type'] = EventKit::EKSourceType.find_index { |i| i[:name] == 'Subscribed' } if obj['subcal_url']
|
95
|
+
type = EventKit::EKSourceType[obj['type']]
|
96
|
+
|
88
97
|
@self['symbolic_color_name'] ||= @self['color']
|
89
98
|
@self['type'] = type[:name]
|
90
99
|
end
|
@@ -130,7 +139,6 @@ module ICalPal
|
|
130
139
|
unless @self['xdate'].any?(@self['sdate']) # Exceptions?
|
131
140
|
o = get_occurrences(changes)
|
132
141
|
o.each { |r| retval.push(r) if in_window?(r['sdate'], r['edate']) }
|
133
|
-
|
134
142
|
end
|
135
143
|
|
136
144
|
apply_frequency!
|
@@ -145,6 +153,9 @@ module ICalPal
|
|
145
153
|
|
146
154
|
# @return a deep clone of self
|
147
155
|
def clone()
|
156
|
+
self['stime'] = @self['sdate'].to_i
|
157
|
+
self['etime'] = @self['edate'].to_i
|
158
|
+
|
148
159
|
Marshal.load(Marshal.dump(self))
|
149
160
|
end
|
150
161
|
|
@@ -190,14 +201,14 @@ module ICalPal
|
|
190
201
|
self['sdate'] = RDT.new(*ndate.to_a[0..2], *self['sdate'].to_a[3..])
|
191
202
|
self['edate'] = RDT.new(*ndate.to_a[0..2], *self['edate'].to_a[3..])
|
192
203
|
retval.push(clone)
|
193
|
-
}) { |i| @self['
|
204
|
+
}) { |i| @self['sday'] == i['sday'] }
|
194
205
|
end
|
195
206
|
|
196
207
|
# Check for changes
|
197
208
|
changes.detect(
|
198
209
|
proc {
|
199
210
|
retval.push(clone)
|
200
|
-
}) { |i| @self['
|
211
|
+
}) { |i| @self['sday'] == i['sday'] } unless retval.count.positive?
|
201
212
|
|
202
213
|
retval
|
203
214
|
end
|
data/lib/options.rb
CHANGED
metadata
CHANGED
@@ -1,40 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icalPal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Rosen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
8z1Sp3Nv8IYOpTc11nDoNCtKHMffd+tKH0nIvp3lGaYfVYJsCfuT56pqmgZiR50S
|
28
|
-
QmlfH+EPXjTlrtg6VJPFzxflqrb4kl+Eaxt67RYbOgVgviXfue2ytKywxnyWGML6
|
29
|
-
EeA+y656Lalvu5XfjLuuqYLIUDJ+jyZDjTsDbUkzPbC/y1i0z4KycRnzETCSryvN
|
30
|
-
HI40svbvW9H+OT3D381Hvk760soXcLgrLA1hz5XQwDBFs7N/U7PeztxuurOw4NOb
|
31
|
-
ctKe1VpldN1JTHdz6u7TAGy0NjC86DF05fvAsEn1baKVZz5P+2OG2FEc+4NWa8/T
|
32
|
-
+v11ZpnzUfxx2TyCM1hTTaphxjAWEYeeylK+ozjZCopJLNkw6uXuni6TrUUQWRAs
|
33
|
-
PDmWrfNO9LeQhiYLyVsOQ1xuWKDF0acQFAVIZctRp4VuZZMVqis4FRmqMdZcB/R2
|
34
|
-
HaQXi3DWVibRuVZ3N77DWUKG
|
35
|
-
-----END CERTIFICATE-----
|
36
|
-
date: 2023-07-21 00:00:00.000000000 Z
|
37
|
-
dependencies: []
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sqlite3
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
38
27
|
description: |
|
39
28
|
Inspired by icalBuddy and maintains close compatability. Includes
|
40
29
|
many additional features for querying, filtering, and formatting.
|
@@ -59,9 +48,9 @@ files:
|
|
59
48
|
- lib/store.rb
|
60
49
|
homepage: https://github.com/ajrosen/icalPal
|
61
50
|
licenses:
|
62
|
-
- GPL-3.0
|
51
|
+
- GPL-3.0-or-later
|
63
52
|
metadata: {}
|
64
|
-
post_install_message:
|
53
|
+
post_install_message:
|
65
54
|
rdoc_options: []
|
66
55
|
require_paths:
|
67
56
|
- lib
|
@@ -76,8 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
65
|
- !ruby/object:Gem::Version
|
77
66
|
version: '0'
|
78
67
|
requirements: []
|
79
|
-
rubygems_version: 3.4
|
80
|
-
signing_key:
|
68
|
+
rubygems_version: 3.5.4
|
69
|
+
signing_key:
|
81
70
|
specification_version: 4
|
82
71
|
summary: Command-line tool to query the macOS Calendar
|
83
72
|
test_files: []
|
checksums.yaml.gz.sig
DELETED
Binary file
|
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
Binary file
|