Michael Crosby


tCal - iCal events in terminal

I just puked up some old code for a little app that displays your iCal events in the terminal. I have it as one of my startup scripts so when I start a new bash session I see my events for the next 7 days. It's a very simple but cool app. I am not proud of the design but I just cleaned up the code tonight and threw it on tCal on Github.

Usage

It is very simple to use. Just throw it in a folder that is in your PATH and type tCal to see your events for the next 5 days (default). if you want more or less days then just:

tCal -d 20

There is no config to setup with your calendars, it just works.

Here is a little taste for the code. Head over to Github for it all.

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        CMCalendar * calendar = [[CMCalendar alloc] init];
        CMArgumentParser * parser = [[CMArgumentParser alloc] init];
        NSInteger days;

        @try {
            days = [(NSString *)[parser argumentForName:@"-d"] integerValue];
        }
        @catch (NSException *exception) {
            days = DEFAULTDAYS;
        }
        NSArray * events = [calendar getEventsForDays:days];
        for (id <ITerminalOutput> output in events) {
            [output display];
        }

    }
    return 0;
}

If you have any ideas just send them to me.

Download Binary

comments powered by Disqus