#!/usr/bin/env python3
#
# (c) 2017 Fetal-Neonatal Neuroimaging & Developmental Science Center
#                   Boston Children's Hospital
#
#              http://childrenshospital.org/FNNDSC/
#                        dev@babyMRI.org
#

import sys, os
sys.path.insert(1, os.path.join(os.path.dirname(__file__), '../pfmisc'))

import  socket
from    argparse            import RawTextHelpFormatter
from    argparse            import ArgumentParser

import  pudb

import  pfmisc
import  pfmisc2
from    _colors             import Colors

str_defIP = [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0]
str_version = "0.99.6"
str_desc = Colors.CYAN + """


        __           _          
       / _|         (_)         
 _ __ | |_ _ __ ___  _ ___  ___ 
| '_ \|  _| '_ ` _ \| / __|/ __|
| |_) | | | | | | | | \__ \ (__ 
| .__/|_| |_| |_| |_|_|___/\___|
| |                             
|_|                             


                            Path-File-misc

           Miscellaneous utilities for the pf* family.

                              -- version """ + \
             Colors.YELLOW + str_version + Colors.CYAN + """ --

    'pfmisc' is a simple example script of how to use the various family
    of miscellaneous help utilties (typically the debug utility) in misc
    settings. 

""" + Colors.NO_COLOUR

parser  = ArgumentParser(description = str_desc, formatter_class = RawTextHelpFormatter)

parser.add_argument(
    '--test',
    help    = 'if specified, perform internal tests',
    dest    = 'b_test',
    action  = 'store_true',
    default = False
)
parser.add_argument(
    '--version',
    help    = 'if specified, print version number',
    dest    = 'b_version',
    action  = 'store_true',
    default = False
)

args            = parser.parse_args()

if args.b_version:
    print("Version: %s" % str_version)
    sys.exit(1)

# pudb.set_trace()

print(str_desc)

example         = pfmisc.pfmisc()
example2        = pfmisc2.pfmisc2()

example.demo()
example2.demo()
