from tools.fonctions_cesar import decode_cesar, code_cesar
from argparse import ArgumentParser
if __name__ == '__main__':
    #function mode available
    func_mode = {'decode': decode_cesar, 'code': code_cesar}
    #create parser for arguments
    parser = ArgumentParser()
    #first argument: which mode ?
    parser.add_argument("mode",help="Choix entre code et decode",choices=func_mode.keys())
    #second argument: path for the file
    parser.add_argument('path',help="emplacement du fichier")
    #parse args with effective args
    res_parser = parser.parse_args()
    #var for quick access to args
    mode = res_parser.mode
    path = res_parser.path
    #get the right func and execute it !
    message = func_mode[mode](path)
    print(message)



