This Is My Blog

There are many like it, but this one is mine.

Accessing Reminders With EventKit (Part 3)

Part 1, Part 2

I left off with the rem command-line app parsing the command-line arguments and stubbed out the functions to handle each command. I’m going to finish up the app by fleshing out each command function.

Before working on the handler functions, I want to do one more thing. I want to check that my command-line arguments actually specify an actual reminder list (calendar) and reminder id (index).

Accessing Reminders With EventKit (Part 2)

Part 1

I want a command-line tool to access data. I was inspired by the command-line password manager, pass. Based on the man page, pass uses the following parameters:

pass [COMMAND] [OPTIONS]... [ARGS]...

This seems like a good model to follow. I’m going to name this command rem, short for reminders. It also reminds me of my old BASIC days, where REM started a comment line.

Here’s the functionality I want for the first iteration:

  • rem [ls] [calendar] list reminders
  • rem rm <calendar> <reminder_id> remove a reminder
  • rem cat <calendar> <reminder_id> show a reminder details
  • rem done <calendar> <reminder_id> mark a reminder as completed

I’m not including functionality to add or modify a reminder (yet). I just don’t need this functionality right now, as I usually add reminders via my iPhone.

Start with the OSX Command Line Tool Application template, with default options of using Foundation and ARC. Add EventKit.framework to the rem target and away we go.

Accessing Reminders With EventKit (Part 1)

I’m old school when it comes to certain things. When the Titanium Powerbook G4 came out, I was excited because I could have six Terminal windows open at once. I still use Emacs. My biggest complaint about Xcode 4 is they got rid of the Emacs client integration.

On the other hand, sometimes newer things work for me as well. When Reminders came out in iOS 5, I started using it, but wasn’t diligent about it. Once it got iCloud and Mountain Lion integration, I started using it a lot more. I even use Siri to make a reminder. I make a reminder on my iPhone, and I have it on all my devices, so I actually keep track of things.

Recently, I started using the command line password manager, pass, to manage my passwords. I tried other password managers, and this is a case where the simpler command-line interface works for me. You type pass and get a list of all your accounts and passwords, which you catagorize. There are simple commands to add, extract and delete passwords. It’s all encrypted using GPG, so I don’t need to worry if I lose my laptop. All the data is stored in my home directory, so it’s part of my Time Machine backups.

zx2c4@laptop ~ $ pass
Password Store
├── Business
│   ├──
│   └──
├── Email
│   ├──
│   └──
└── France
    ├── bank
    ├── freebox
    └── Mobilephone

I wanted some similar for to access reminders. Now Apple’s been pretty good about making command-line equivalents for a lot of UI tools (think and diskutil), but this is one where they don’t have anything. A quick Google didn’t really find anything for me either.

So I have roll up my sleeves and write something myself.