icalPal 3.4.0 → 3.5.0

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: 3a74d33ac1b8d65466f6ef4820813ad983c7bb539438c11d12eb61daaa2af83f
4
- data.tar.gz: 3c2790143a7b5abde6304312099988de264cc767fde30c34dd8b7682a80bd782
3
+ metadata.gz: f2549d35908833fd3fbb48d98187e3ee5618fb3c610dcb03659e8f41b67ac91d
4
+ data.tar.gz: b5999da17435b5eefbc1f19fe8822c45c5ffec0741f5cb58d7f64c313d700ca2
5
5
  SHA512:
6
- metadata.gz: 031fae41c01699e5eb757dd0f838e702fccd0d65fb3ab1aca3a6dde20083ed5ec43c88a1bc2c43e11e0a77399aea21e860d3f13f7590d90a00f912d3d87bff1b
7
- data.tar.gz: 9e1cfa76f56f735406553d40d13e16ce786461ab331eea9cc0757ffe0858e92ef3c9bae843934f9a55098ec1a28d6e03852aed3ce3bc244a56de362b584de5bd
6
+ metadata.gz: 64f542aa97dd5b66c28001b0f70ef289a447bc89b5272ed3a4916930a048ea2c2baed4c75b7fe71310611827b0e6e8b0a0dd13665807dba91816e72a6647b0d9
7
+ data.tar.gz: e229b5a9a3261c1f145f1692d4abeb26e653e2e8c7d086d1d0f3a900fe1dfe13a8c68477ddbb22538262d27d1f7fd9cdb7ad302693815e4cb721955c5c379e30
data/README.md CHANGED
@@ -43,9 +43,10 @@ gem install --user-install icalPal
43
43
 
44
44
  ### Compatability with icalBuddy
45
45
 
46
- icalPal tries to be compatible with [icalBuddy](https://github.com/ali-rantakari/icalBuddy) for command-line options
47
- and for output. There are a some important differences to be aware
48
- of.
46
+ icalPal tries to be compatible with
47
+ [icalBuddy](https://github.com/ali-rantakari/icalBuddy) for
48
+ command-line options and for output. There are a some important
49
+ differences to be aware of.
49
50
 
50
51
  * Options require two hyphens, except for single-letter options that require one hyphen
51
52
  * *eventsFrom* is not supported. Instead there is *--from*, *--to*, and *--days*
@@ -59,7 +60,8 @@ of.
59
60
 
60
61
  ```icalPal accounts```
61
62
 
62
- Shows a list of enabled Calendar accounts. Internally they are known as *Stores*; you can run ```icalPal stores``` instead.
63
+ Shows a list of enabled Calendar accounts. Internally they are known
64
+ as *Stores*; you can run ```icalPal stores``` instead.
63
65
 
64
66
  ```icalPal datedTasks```
65
67
 
@@ -79,7 +81,9 @@ Shows only reminders that have a due date.
79
81
  * ```--color``` uses a wider color palette. Calendar colors are what you have chosen in the Calendar app. Not supported in all terminals, but looks great in [iTerm2](https://iterm2.com/).
80
82
  * ```--match``` lets you filter the results of any command to items where a *FIELD* matches a regular expression. Eg., ```--match notes=zoom.us``` to show only Zoom meeetings
81
83
 
82
- Because icalPal is written in Ruby, and not a native Mac application, you can run it just about anywhere. It's been tested with the version of Ruby (2.6.10) included with macOS.
84
+ Because icalPal is written in Ruby, and not a native Mac application,
85
+ you can run it just about anywhere. It's been tested with the version
86
+ of Ruby (2.6.10) included with macOS.
83
87
 
84
88
  ## Usage
85
89
 
@@ -102,10 +106,12 @@ COMMAND must be one of the following:
102
106
  Global options:
103
107
  ```
104
108
  -c, --cmd=COMMAND Command to run
105
- --db=DB Use DB file instead of Calendar (default: /Users/ajr/Library/Calendars/Calendar.sqlitedb)
109
+ --db=DB Use DB file instead of Calendar
110
+ (default: ["/Users/user/Library/Group Containers/group.com.apple.calendar/Calendar.sqlitedb", "/Users/user/Library/Calendars/Calendar.sqlitedb"]
106
111
  For the tasks commands this should be a directory containing .sqlite files
107
- (default: /Users/ajr/Library/Group Containers/group.com.apple.reminders/Container_v1/Stores)
108
- --cf=FILE Set config file path (default: /Users/ajr/.icalpal)
112
+ (default: /Users/user/Library/Group Containers/group.com.apple.reminders/Container_v1/Stores)
113
+ --cf=FILE Set config file path (default: /Users/user/.icalpal)
114
+ --norc Ignore ICALPAL and ICALPAL_CONFIG environment variables
109
115
  -o, --output=FORMAT Print as FORMAT (default: default)
110
116
  [ansi, csv, default, hash, html, json, md, rdoc, remind, toc, xml, yaml]
111
117
  ```
@@ -209,7 +215,7 @@ Environment variables:
209
215
  ```
210
216
  ICALPAL Additional arguments
211
217
  ICALPAL_CONFIG Additional arguments from a file
212
- (default: /Users/ajr/.icalpal)
218
+ (default: /Users/user/.icalpal)
213
219
 
214
220
  Do not quote or escape values. Options set in ICALPAL override ICALPAL_CONFIG. Options on the command line override ICALPAL.
215
221
  ```
@@ -223,7 +229,8 @@ CSV, Hash, JSON, XML, and YAML print all fields for all items in their
223
229
  respective formats. From that you can analyze the results any way you
224
230
  like.
225
231
 
226
- [Remind](https://dianne.skoll.ca/projects/remind/) format uses a minimal implementation built into icalPal.
232
+ [Remind](https://dianne.skoll.ca/projects/remind/) format uses a
233
+ minimal implementation built into icalPal.
227
234
 
228
235
  Other formats such as ANSI, HTML, Markdown, RDoc, and TOC, use Ruby's
229
236
  [RDoc::Markup](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup.html)
@@ -232,7 +239,8 @@ framework to build and render the items.
232
239
  Each item to be printed is a new
233
240
  [RDoc::Markup::Document](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup/Document.html).
234
241
 
235
- When using one of the <em>separate by</em> options, a section header is added first. The section contains:
242
+ When using one of the <em>separate by</em> options, a section header
243
+ is added first. The section contains:
236
244
 
237
245
  * [RDoc::Markup::BlankLine](https://ruby-doc.org/stdlib-2.6.10/libdoc/rdoc/rdoc/RDoc/Markup/BlankLine.html)
238
246
  (unless this is the first section)
@@ -259,9 +267,10 @@ information about the item and property to the default formatter.
259
267
  ## History
260
268
 
261
269
  I used icalBuddy for many years. It's great for scripting,
262
- automation, and as a desktop widget for apps like
263
- [GeekTool](https://www.tynsoe.org/geektool/) and
264
- [Übersicht](https://tracesof.net/uebersicht/).
270
+ automation, and as a widget for apps like
271
+ [Übersicht](https://tracesof.net/uebersicht/),
272
+ [GeekTool](https://www.tynsoe.org/geektool/), and
273
+ [SketchyBar](https://felixkratz.github.io/SketchyBar/).
265
274
 
266
275
  As with many applications, I started to run into some limitations in
267
276
  icalBuddy. The biggest being that active development ended in 2014.
@@ -270,7 +279,7 @@ Lawton](https://github.com/jimlawton) that it even compiles anymore.
270
279
 
271
280
  Instead of trying to understand and extend the existing code, I chose
272
281
  to start anew using my language of choice: Ruby. Using Ruby meant
273
- there is *much* less code; about 1,800 lines vs. 7,000. It also means
282
+ there is *much* less code; less than 2,000 lines vs. 7,000. It also means
274
283
  icalPal is multi-platform.
275
284
 
276
285
  I won't pretend to understand **why** you would want to run this on
data/bin/icalPal CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  require 'yaml'
11
11
 
12
12
  require_relative '../lib/icalpal'
13
+ require_relative '../lib/defaults'
13
14
  require_relative '../lib/options'
14
15
  require_relative '../lib/utils'
15
16
  rescue LoadError => e
data/bin/icalpal CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  require 'yaml'
11
11
 
12
12
  require_relative '../lib/icalpal'
13
+ require_relative '../lib/defaults'
13
14
  require_relative '../lib/options'
14
15
  require_relative '../lib/utils'
15
16
  rescue LoadError => e
data/lib/defaults.rb CHANGED
@@ -27,6 +27,7 @@ $defaults = {
27
27
  is: [],
28
28
  it: [],
29
29
  li: 0,
30
+ norc: false,
30
31
  output: 'default',
31
32
  ps: [ "\n " ],
32
33
  r: false,
@@ -38,32 +39,38 @@ $defaults = {
38
39
  sp: false,
39
40
  tf: '%-I:%M %p',
40
41
  },
42
+
41
43
  tasks: {
42
44
  dated: 0,
43
45
  db: [ ICalPal::Reminder::DB_PATH ],
44
46
  iep: %w[ title notes due priority ],
45
47
  sort: 'prio',
46
48
  },
49
+
47
50
  undatedTasks: {
48
51
  dated: 1,
49
52
  db: [ ICalPal::Reminder::DB_PATH ],
50
53
  iep: %w[ title notes due priority ],
51
54
  sort: 'prio',
52
55
  },
56
+
53
57
  datedTasks: {
54
58
  dated: 2,
55
59
  db: [ ICalPal::Reminder::DB_PATH ],
56
60
  iep: %w[ title notes due priority ],
57
61
  sort: 'prio',
58
62
  },
63
+
59
64
  stores: {
60
65
  iep: %w[ account type ],
61
66
  sort: 'account',
62
67
  },
68
+
63
69
  calendars: {
64
70
  iep: %w[ calendar type UUID ],
65
71
  sort: 'calendar',
66
72
  },
73
+
67
74
  events: {
68
75
  days: nil,
69
76
  ea: false,
data/lib/event.rb CHANGED
@@ -177,10 +177,10 @@ module ICalPal
177
177
  skip = false
178
178
 
179
179
  changes[1..].each do |change|
180
- cdate = Time.at(change['start_date'] + ITIME).to_a[3..5].reverse
180
+ codate = Time.at(change['orig_date'] + ITIME).to_a[3..5].reverse
181
181
  odate = occurrence['sdate'].ymd
182
182
 
183
- skip = true if cdate == odate
183
+ skip = true if codate == odate
184
184
  end
185
185
 
186
186
  events.push(clone(occurrence)) if in_window?(occurrence['sdate'], occurrence['edate']) && !skip
data/lib/options.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  # rubocop: disable Style/FormatString, Style/FormatStringToken
2
2
 
3
- require 'optparse'
3
+ autoload(:OptionParser, 'optparse')
4
4
 
5
- require_relative 'defaults'
6
5
  require_relative 'version'
7
6
 
8
7
  module ICalPal
@@ -55,6 +54,7 @@ module ICalPal
55
54
  'For the tasks commands this should be a directory containing .sqlite files',
56
55
  "(default: #{$defaults[:tasks][:db]})")
57
56
  @op.on('--cf=FILE', "Set config file path (default: #{$defaults[:common][:cf]})")
57
+ @op.on('--norc', 'Ignore ICALPAL and ICALPAL_CONFIG environment variables')
58
58
  @op.on('-o', '--output=FORMAT', OUTFORMATS,
59
59
  "Print as FORMAT (default: #{$defaults[:common][:output]})", "[#{OUTFORMATS.join(', ')}]")
60
60
 
@@ -211,7 +211,7 @@ module ICalPal
211
211
  end
212
212
 
213
213
  @op.parse!(o, into: env)
214
- end if ENV['ICALPAL']
214
+ end if ENV['ICALPAL'] && !cli[:norc]
215
215
 
216
216
  # Configuration file needs special parsing for the same reason
217
217
  begin
@@ -230,7 +230,7 @@ module ICalPal
230
230
 
231
231
  @op.parse!(o, into: cf)
232
232
  rescue StandardError
233
- end
233
+ end unless cli[:norc]
234
234
 
235
235
  cli[:cmd] ||= @op.default_argv[0]
236
236
  cli[:cmd] ||= env[:cmd] if env[:cmd]
@@ -240,10 +240,10 @@ module ICalPal
240
240
  # Parse eventsNow and eventsToday commands
241
241
  cli[:cmd].match('events(Now|Today)(\+[0-9]+)?') do |m|
242
242
  cli[:now] = true if m[1] == 'Now'
243
- cli[:days] = (m[1] == 'Today')? m[2].to_i + 1 : 1
243
+ cli[:days] = (m[1] == 'Today')? m[2].to_i : 1
244
244
 
245
245
  cli[:from] = $today
246
- cli[:to] = $today + cli[:days]
246
+ cli[:to] = $today + cli[:days] if cli[:days]
247
247
  cli[:days] = Integer(cli[:to] - cli[:from])
248
248
 
249
249
  cli[:cmd] = 'events'
@@ -330,7 +330,9 @@ module ICalPal
330
330
  # Pad non-options to align with options
331
331
  #
332
332
  # @param t [String] Text on the left side
333
- # @return [String] Text indented by summary_indent, and padded according to summary_width
333
+ #
334
+ # @return [Array<String>] Array containing +summary_indent+, +t+,
335
+ # a number of spaces equal to (+summary_width+ - +t.length+)
334
336
  def pad(t)
335
337
  [ @op.summary_indent, t, ' ' * (@op.summary_width - t.length) ]
336
338
  end
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module ICalPal
2
2
  NAME = 'icalPal'.freeze
3
- VERSION = '3.4.0'.freeze
3
+ VERSION = '3.5.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalPal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Rosen
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-08 00:00:00.000000000 Z
10
+ date: 2025-05-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri-plist