sonar/cli.py
def tool(parser):
    """
    Parse the "tool" argument

    Args:
        parser (argparse._SubParserAction): The parser object
    """
    subparser = parser.add_parser(
        "tool", help="Manage hw tools", add_help=False
    )
    subsubparser = subparser.add_subparsers(
        title="Commands", metavar="command"
    )

    # def add():
    #     command = subsubparser.add_parser(
    #         "add",
    #         help="Add a tool to sonar's database",
    #         add_help=False,
    #         description=textwrap.dedent(
    #             f"""Adds a tool to sonar's database."""
    #         ),
    #     )
    #     command_group = command.add_argument_group("Arguments")
    #     command_group.add_argument("type", type=str, help="Type of tool to add")
    #     command_group.add_argument("version", type=str, help="version of tool")
    #     command_group.add_argument(
    #         "cad_executable", type=str, help="Name of the cad tool executable"
    #     )
    #     command_group.add_argument(
    #         "sim_executable", type=str, help="Name of the sim tool executable"
    #     )
    #     command_group.add_argument(
    #         "hls_executable", type=str, help="Name of the hls tool executable"
    #     )
    #     command_group.add_argument(
    #         "script", type=str, help="Shell commands to setup using the tools"
    #     )
    #     # command_group.add_argument(
    #     #     "arg", type=str, nargs="+", help="Value to set to variable"
    #     # )
    #     command.set_defaults(func=api.Tool.add)
    #     add_help(command)

    # def remove():
    #     command = subsubparser.add_parser(
    #         "remove",
    #         help="Remove a tool from sonar's database",
    #         add_help=False,
    #         description=f"""Removes a tool from sonar's database.

    #         The type must be one of: {tool_types}.
    #         """,
    #     )
    #     command_group = command.add_argument_group("Arguments")
    #     command_group.add_argument("type", type=str, help="Type of tool to remove")
    #     command_group.add_argument("ID", type=str, help="ID of tool")
    #     command.set_defaults(func=api.Tool.remove)
    #     add_help(command)

    # def edit():
    #     command = subsubparser.add_parser(
    #         "edit",
    #         help="Edit a tool in sonar's database",
    #         add_help=False,
    #         description=f"""Removes a tool from sonar's database.

    #         The type must be one of: {tool_types}.
    #         """,
    #     )
    #     command_group = command.add_argument_group("Arguments")
    #     command_group.add_argument("type", type=str, help="Type of tool to edit")
    #     command_group.add_argument("ID", type=str, help="ID of tool")
    #     command_group.add_argument("value", type=str, help="Value to set to variable")
    #     command.set_defaults(func=api.Tool.edit)
    #     add_help(command)

    def f_list():
        command = subsubparser.add_parser(
            "list",
            help="List sonar's database",
            add_help=False,
            description="Lists sonar's database",
        )
        command.set_defaults(func=api.Tool.f_list)
        add_help(command)

    def clear():
        command = subsubparser.add_parser(
            "clear",
            help="Clear sonar's database and reset it to default",
            add_help=False,
            description="Clears sonar's environment database and resets it to default",
        )
        command.set_defaults(func=api.Tool.clear)
        add_help(command)

    # add()
    # remove()
    # edit()
    clear()
    f_list()
    add_help(subparser)

    Parse the "tool" argument

    Args:
        parser (argparse._SubParserAction): The parser object
    
Parse the "tool" argument
Parse the " tool " argument
def tool(parser):
    subparser = parser.add_parser(
        "tool", help="Manage hw tools", add_help=False
    )
    subsubparser = subparser.add_subparsers(
        title="Commands", metavar="command"
    )
    "type", type=str, help="Type of tool to remove")
    "ID", type=str, help="ID of tool")
    "type", type=str, help="Type of tool to edit")
    "ID", type=str, help="ID of tool")
    "value", type=str, help="Value to set to variable")
    def f_list():
        command = subsubparser.add_parser(
            "list",
            help="List sonar's database",
            add_help=False,
            description="Lists sonar's database",
        )
        command.set_defaults(func=api.Tool.f_list)
        add_help(command)
    def clear():
        command = subsubparser.add_parser(
            "clear",
            help="Clear sonar's database and reset it to default",
            add_help=False,
            description="Clears sonar's environment database and resets it to default",
        )
        command.set_defaults(func=api.Tool.clear)
        add_help(command)
    clear()
    f_list()
    add_help(subparser)
def tool ( parser ) : subparser = parser . add_parser ( "tool" , help = "Manage hw tools" , add_help = False ) subsubparser = subparser . add_subparsers ( title = "Commands" , metavar = "command" ) def f_list ( ) : command = subsubparser . add_parser ( "list" , help = "List sonar's database" , add_help = False , description = "Lists sonar's database" , ) command . set_defaults ( func = api . Tool . f_list ) add_help ( command ) def clear ( ) : command = subsubparser . add_parser ( "clear" , help = "Clear sonar's database and reset it to default" , add_help = False , description = "Clears sonar's environment database and resets it to default" , ) command . set_defaults ( func = api . Tool . clear ) add_help ( command ) clear ( ) f_list ( ) add_help ( subparser )
Parse the "tool" argument
Parse the " tool " argument
"""
    Parse the "tool" argument

    Args:
        parser (argparse._SubParserAction): The parser object
    """ # def add(): #     command = subsubparser.add_parser( #         "add", #         help="Add a tool to sonar's database", #         add_help=False, #         description=textwrap.dedent( #             f"""Adds a tool to sonar's database.""" #         ), #     ) #     command_group = command.add_argument_group("Arguments") #     command_group.add_argument("type", type=str, help="Type of tool to add") #     command_group.add_argument("version", type=str, help="version of tool") #     command_group.add_argument( #         "cad_executable", type=str, help="Name of the cad tool executable" #     ) #     command_group.add_argument( #         "sim_executable", type=str, help="Name of the sim tool executable" #     ) #     command_group.add_argument( #         "hls_executable", type=str, help="Name of the hls tool executable" #     ) #     command_group.add_argument( #         "script", type=str, help="Shell commands to setup using the tools" #     ) #     # command_group.add_argument( #     #     "arg", type=str, nargs="+", help="Value to set to variable" #     # ) #     command.set_defaults(func=api.Tool.add) #     add_help(command) # def remove(): #     command = subsubparser.add_parser( #         "remove", #         help="Remove a tool from sonar's database", #         add_help=False, #         description=f"""Removes a tool from sonar's database. #         The type must be one of: {tool_types}. #         """, #     ) #     command_group = command.add_argument_group("Arguments") #     command_group.add_argument("type", type=str, help="Type of tool to remove") #     command_group.add_argument("ID", type=str, help="ID of tool") #     command.set_defaults(func=api.Tool.remove) #     add_help(command) # def edit(): #     command = subsubparser.add_parser( #         "edit", #         help="Edit a tool in sonar's database", #         add_help=False, #         description=f"""Removes a tool from sonar's database. #         The type must be one of: {tool_types}. #         """, #     ) #     command_group = command.add_argument_group("Arguments") #     command_group.add_argument("type", type=str, help="Type of tool to edit") #     command_group.add_argument("ID", type=str, help="ID of tool") #     command_group.add_argument("value", type=str, help="Value to set to variable") #     command.set_defaults(func=api.Tool.edit) #     add_help(command) # add() # remove() # edit()
parser
The parser object
The parser object