#!/usr/bin/python3

import sys
import argparse
from SystemLib import ogHelp
from FileSystemLib import ogFormat
from CacheLib import ogFormatCache

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

if 2 == len (sys.argv) and 'cache' == sys.argv[1]:
    ret = ogFormatCache()
else:
    parser = argparse.ArgumentParser (add_help=False)
    parser.add_argument ('disk')
    parser.add_argument ('par')
    parser.add_argument ('fs', nargs='?', default=None)
    parser.add_argument ('label', nargs='?', default=None)
    args = parser.parse_args()
    ret = ogFormat (args.disk, args.par, args.fs, args.label)

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