@cli.command(short_help="<STR_LIT>")<EOL>@click.argument('<STR_LIT>')<EOL>@click.argument('<STR_LIT:description>', nargs=-<NUM_LIT:1>)<EOL>@click.option('<STR_LIT>', '<STR_LIT>', '<STR_LIT:f>', type=click.Path(dir_okay=False),<EOL>help="<STR_LIT>")<EOL>@click.pass_context<EOL>def start(ctx, alias, description, f):
today = datetime.date.today()<EOL>try:<EOL><INDENT>timesheet_collection = get_timesheet_collection_for_context(ctx, f)<EOL><DEDENT>except ParseError as e:<EOL><INDENT>ctx.obj['<STR_LIT>'].err(e)<EOL>return<EOL><DEDENT>t = timesheet_collection.latest()<EOL>today_entries = t.entries.filter(date=today)<EOL>if(today in today_entries and today_entries[today]<EOL>and isinstance(today_entries[today][-<NUM_LIT:1>].duration, tuple)<EOL>and today_entries[today][-<NUM_LIT:1>].duration[<NUM_LIT:1>] is not None):<EOL><INDENT>new_entry_start_time = today_entries[today][-<NUM_LIT:1>].duration[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>new_entry_start_time = datetime.datetime.now()<EOL><DEDENT>description = '<STR_LIT:U+0020>'.join(description) if description else '<STR_LIT:?>'<EOL>duration = (new_entry_start_time, None)<EOL>e = Entry(alias, duration, description)<EOL>t.entries[today].append(e)<EOL>t.save()<EOL>
Use it when you start working on the given activity. This will add the
activity and the current time to your entries file. When you're finished,
use the stop command.