#!/usr/bin/python3

import sys
import argparse
from SystemLib import ogHelp
from RegistryLib import ogAddRegistryValue

parser = argparse.ArgumentParser (add_help=False)
parser.add_argument ('mntpt')
parser.add_argument ('hive')
parser.add_argument ('k')
parser.add_argument ('vtype', nargs='?', default='STRING')

if 2 == len (sys.argv) and 'help' == sys.argv[1]:
    #parser.print_help() sale en inglés aunque la locale indique otra cosa
    ogHelp ('ogAddRegistryValue', 'ogAddRegistryValue path_mountpoint str_hive str_valuename [str_valuetype]', [r'ogAddRegistryValue /mnt/sda1 SOFTWARE "\Microsoft\NewKey\Value1"', r'ogAddRegistryValue /mnt/sda1 SOFTWARE "\Microsoft\NewKey\Value1" DWORD'])
    sys.exit (0)

args = parser.parse_args()

ret = ogAddRegistryValue (args.mntpt, args.hive, args.k, args.vtype)
if ret is not None:
    if   ret == True: sys.exit (0)
    elif ret == False: sys.exit (1)
    else: print (ret)
