Main function of faradayio-cli client.

    Informs user of version being run and then sets up the program followed
    by starting up the TUN/TAP device threads.

def main():
    """Main function of faradayio-cli client.

    Informs user of version being run and then sets up the program followed
    by starting up the TUN/TAP device threads.
    """
    print("Executing faradayio-cli version {0}".format(__version__))

    # Setup command line arguments
    try:
        args = setupArgparse()

    except argparse.ArgumentError as error:
        raise SystemExit(error)

    # Setup serial port
    try:
        serialPort = setupSerialPort(args.loopback, args.port)

    except serial.SerialException as error:
        raise SystemExit(error)

    # Create TUN adapter name
    tunName = "{0}-{1}".format(args.callsign.upper(), args.id)

    # Create threading event for TUN thread control
    # set() causes while loop to continuously run until clear() is run
    isRunning = threading.Event()
    isRunning.set()

    # Setup TUN adapter and start
    try:
        tun = Monitor(serialPort=serialPort, name=tunName, isRunning=isRunning)
        tun.start()

    except pytun.Error as error:
        print("Warning! faradayio-cli must be run with sudo privileges!")
        raise SystemExit(error)

    # loop infinitely until KeyboardInterrupt, then clear() event, exit thread
    try:
        while True:
            # Check for KeyboardInterrupt every 100ms
            time.sleep(0.1)

    except KeyboardInterrupt:
        tun.isRunning.clear()
        tun.join()