#!/usr/bin/env python

import sys
from pedigreetools.pedigree import DataSet
from pedigreetools.operations import *
from pedigreetools.utils.cli import CLI

def main():
    if sys.version_info[0] != 3 or sys.version_info[1] < 7:
        print("This script requires Python version 3.7")
        sys.exit(1)
    
    cli = CLI()
    cli.run([WelcomeOperation(), SpecifyFileOperation()])

    while True:
        select = SelectOperation([
            DeriveYOBsOperation(),
            DeriveYOBsOperation(calculate_everything=True),
            SaveFileOperation(),
            InfoOperation(),
            QuitOperation()
        ])

        cli.run([select])

        next_operation = cli.context.operation
        cli.context.operation = None

        if next_operation:
            cli.run([next_operation])

if __name__ == "__main__":
    main()
