def command(timebook, config, switch, start_time, end_time, messages, **kwargs): # get the db cfg=parse_config(config) db=Database(timebook, cfg) if switch: commands.switch.switch(db, switch) sheet = switch else: sheet = db.get_current_sheet() timestamp_in=parse_date_time(start_time) timestamp_out=parse_date_time(end_time) current_start = db.get_start_time(sheet) if current_start: if timestamp_out > current_start[1]: parser.error('cannot put this entry into the timesheet because ' \ 'it may cause overlap with the active timer - clock out first') message = ' '.join(messages) put(db, sheet, timestamp_in, timestamp_out, message)