Exemple #1
0
def main():
    if len(sys.argv) == 1:
        # This should happen automatically with argparser, but it doesn't.
        sys.argv.append('-help')

    try:
        sheet = TymeSheet.from_file()
    except FileNotFoundError:
        # First time!
        sheet = TymeSheet()
    args = PARSER.parse_args()
    
    try:
        args.func(sheet, args)
    except TymeError as e:
        print('ERROR:', e)
        exit(1)
Exemple #2
0
def undo_cmd(sheet, args):
    backup = sheet.file + '~'
    old = TymeSheet.from_file(backup)
    old.save()
    print('Undo!')