Exemplo n.º 1
0
def check_entries_file(parser, settings):
    for date, entries in parser.entries.iteritems():
        for entry in entries:
            if not settings.project_exists(entry.project_name):
                error = 'Error: project `%s` is not mapped to any project number'\
                ' in your settings file' % entry.project_name

                raise ProjectNotFoundError(entry.project_name, error)
Exemplo n.º 2
0
def start(options, args):
    """Usage: start project_name

    Use it when you start working on the project project_name. This will add the
    project name and the current time to your entries file. When you're
    finished, use the stop command."""

    if len(args) < 2:
        raise Exception(start.__doc__)

    project_name = args[1]

    if not settings.project_exists(project_name):
        raise ProjectNotFoundError(project_name, 'Error: the project \'%s\' doesn\'t exist' %\
                project_name)

    create_file(options.file)

    parser = get_parser(options.file)
    auto_add = get_auto_add_direction(options.file, options.unparsed_file)
    parser.add_entry(datetime.date.today(), project_name,\
            (datetime.datetime.now().time(), None), auto_add)
    parser.update_file()