#!/usr/bin/python

import os
import sys

args = sys.argv[1:]

user = 'user'
if '-u' in args:
    user = args[args.index('-u')+1]

if '-l' in args:
    if not os.path.exists('data/%s.tab' % user):
        sys.stderr.write("no crontab for %s\n" % user)
        sys.exit(1)
    fhl = open('data/%s.tab' % user, 'r')
    print fhl.read()
else:
    for a in args:
        if a[0] != '-' and a != user:
            # We could save the crontab here, but not right now
            pass

sys.exit(0)
