#!/usr/bin/python3

## this script doesn't call ogMount. It replicates the functionality instead.

import sys
import argparse
from SystemLib import ogHelp
from CacheLib import ogMountCache
from FileSystemLib import ogMountCdrom, ogMountFs

if 2 == len (sys.argv) and 'help' == sys.argv[1]:
    #parser.print_help() sale en inglés aunque la locale indique otra cosa
    ogHelp ('ogMount')
    sys.exit (0)

parser = argparse.ArgumentParser (add_help=False)
done = False
if 2 == len (sys.argv):
    if 'cache' == sys.argv[1].lower():
        done = True
        ret = ogMountCache()
    elif 'cdrom' == sys.argv[1].lower():
        done = True
        ret = ogMountCdrom()

if not done:
    parser.add_argument ('disk')
    parser.add_argument ('par')
    args = parser.parse_args()
    ret = ogMountFs (args.disk, args.par)

if ret is not None:
    if   ret == True: sys.exit (0)
    elif ret == False: sys.exit (1)
    else: print (ret)
