#!/usr/bin/python3

import sys
import argparse
from SystemLib import ogHelp
from DiskLib import ogCreatePartitionTable

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

parser = argparse.ArgumentParser (add_help=False)
if 2 == len (sys.argv):
    parser.add_argument ('disk')
elif 3 == len (sys.argv):
    parser.add_argument ('disk')
    parser.add_argument ('createptt')

args = parser.parse_args()

if 2 == len (sys.argv):
    ret = ogCreatePartitionTable (args.disk)
elif 3 == len (sys.argv):
    ret = ogCreatePartitionTable (args.disk, args.createptt)

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