#!/usr/bin/python3

import sys
import argparse
import ogGlobals
from SystemLib import ogHelp
from BootLib import ogGrubHidePartitions

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

parser = argparse.ArgumentParser (add_help=False)
if 3  == len (sys.argv):
    parser.add_argument ('disk')
    parser.add_argument ('par')
elif 5  == len (sys.argv):
    parser.add_argument ('disk')
    parser.add_argument ('par')
    parser.add_argument ('datadisk')
    parser.add_argument ('datapar')

args = parser.parse_args()
if 3  == len (sys.argv):
    ret = ogGrubHidePartitions (args.disk, args.par)
elif 5  == len (sys.argv):
    ret = ogGrubHidePartitions (args.disk, args.par, args.datadisk, args.datapar)

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