# -*- coding: utf-8 -*-
"""
    Implementation of RCON help command

Copyright 2024 NXP
SPDX-License-Identifier: BSD-3-Clause

"""

import gdb   # @UnresolvedImport  # pylint: disable=F0401
import argparse
import binascii
import importlib

from rcon.gdbcommands.base_command import RconBase
from rcon.gdbcommands.cmd_name import CMD_RCON_HELP


global RCON
###################################################################
######### RCON Help command
###################################################################
class RconHelp(RconBase):
    """
usage: Displays list of RCON expected values. [-h] No parameters.

S32DS RCON help command.

optional arguments:
  -h, --help            show this help message and exit
    """

    def __init__(self):
        """
            Register new command with GDB
        """
        super(RconHelp, self).__init__(CMD_RCON_HELP,
        gdb.COMMAND_USER, gdb.COMPLETE_FILENAME)
        parser = argparse.ArgumentParser(usage='[-h]',
                                         description='S32DS \
                                         RCON help command.')
        self._parser = parser


    def execute(self, args):
        #execute command
        RCON.RCON_HELP()


    def begin_command(self):
        gdb.write('Displaying Help....\n')

    def end_command(self):
        gdb.write('Ending Help....\n')

def create_command(RCONfilePath):
    """
        Instantiate RCON help command
    """
    global RCON 
    RCON = importlib.import_module(RCONfilePath[:-3])
    RconHelp()
