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

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

    def add():
        command = subsubparser.add_parser(
            "add",
            help="Add the repo to sonar",
            add_help=False,
            description=textwrap.dedent(
                """\
                Adds the current repo to sonar's database
                """
            ),
        )
        command.set_defaults(func=api.Repo.add)
        add_help(command)

    # def remove():
    #     command = subsubparser.add_parser(
    #         "remove",
    #         help="Remove an env",
    #         add_help=False,
    #         description="Removes an env",
    #     )
    #     command_group = command.add_argument_group("Arguments")
    #     command_group.add_argument("name", type=str, help="Name of env to remove")
    #     command.set_defaults(func=api.Env.remove)
    #     add_help(command)

    # def edit():
    #     command = subsubparser.add_parser(
    #         "edit",
    #         help="Edit an env",
    #         add_help=False,
    #         description="Edits an env elements",
    #     )
    #     command_group = command.add_argument_group("Arguments")
    #     command_group.add_argument("name", type=str, help="Name of env")
    #     command_group.add_argument("cad", type=str, help="CAD tool")
    #     command_group.add_argument("sim", type=str, help="Sim tool")
    #     command_group.add_argument("hls", type=str, help="HLS tool")
    #     command_group.add_argument("repo", type=str, help="Repository")
    #     command_group.add_argument("board", type=str, help="Board")
    #     command.set_defaults(func=api.Env.edit)
    #     add_help(command)

    def f_list():
        command = subsubparser.add_parser(
            "list",
            help="List sonar repos",
            add_help=False,
            description="Lists sonar repos",
        )
        command.set_defaults(func=api.Repo.f_list)
        add_help(command)

    def clear():
        command = subsubparser.add_parser(
            "clear",
            help="Clear sonar's repos",
            add_help=False,
            description="Clears sonar's repos",
        )
        command.set_defaults(func=api.Repo.clear)
        add_help(command)

    def f_activate():
        command = subsubparser.add_parser(
            "activate",
            help="Activate a repo",
            add_help=False,
            description="Activates a repo",
        )

        command_group = command.add_argument_group("Arguments")
        command_group.add_argument(
            "name",
            type=str,
            help="Name of the repo to activate",
        )
        command.set_defaults(func=api.Repo.activate)
        add_help(command)

    f_activate()
    add()
    clear()
    f_list()
    add_help(subparser)

    Parse the "repo" argument

    Args:
        parser (argparse._SubParserAction): The parser object
    
Parse the "repo" argument
Parse the " repo " argument
def repo(parser):
    subparser = parser.add_parser(
        "repo", help="Manage sonar repos", add_help=False
    )
    subsubparser = subparser.add_subparsers(
        title="Commands", metavar="command"
    )
    def add():
        command = subsubparser.add_parser(
            "add",
            help="Add the repo to sonar",
            add_help=False,
            description=textwrap.dedent(
                """\
                Adds the current repo to sonar's database
                """
            ),
        )
        command.set_defaults(func=api.Repo.add)
        add_help(command)
    def f_list():
        command = subsubparser.add_parser(
            "list",
            help="List sonar repos",
            add_help=False,
            description="Lists sonar repos",
        )
        command.set_defaults(func=api.Repo.f_list)
        add_help(command)
    def clear():
        command = subsubparser.add_parser(
            "clear",
            help="Clear sonar's repos",
            add_help=False,
            description="Clears sonar's repos",
        )
        command.set_defaults(func=api.Repo.clear)
        add_help(command)
    def f_activate():
        command = subsubparser.add_parser(
            "activate",
            help="Activate a repo",
            add_help=False,
            description="Activates a repo",
        )
        command_group = command.add_argument_group("Arguments")
        command_group.add_argument(
            "name",
            type=str,
            help="Name of the repo to activate",
        )
        command.set_defaults(func=api.Repo.activate)
        add_help(command)
    f_activate()
    add()
    clear()
    f_list()
    add_help(subparser)
def repo ( parser ) : subparser = parser . add_parser ( "repo" , help = "Manage sonar repos" , add_help = False ) subsubparser = subparser . add_subparsers ( title = "Commands" , metavar = "command" ) def add ( ) : command = subsubparser . add_parser ( "add" , help = "Add the repo to sonar" , add_help = False , description = textwrap . dedent ( """\
                Adds the current repo to sonar's database
                """ ) , ) command . set_defaults ( func = api . Repo . add ) add_help ( command ) def f_list ( ) : command = subsubparser . add_parser ( "list" , help = "List sonar repos" , add_help = False , description = "Lists sonar repos" , ) command . set_defaults ( func = api . Repo . f_list ) add_help ( command ) def clear ( ) : command = subsubparser . add_parser ( "clear" , help = "Clear sonar's repos" , add_help = False , description = "Clears sonar's repos" , ) command . set_defaults ( func = api . Repo . clear ) add_help ( command ) def f_activate ( ) : command = subsubparser . add_parser ( "activate" , help = "Activate a repo" , add_help = False , description = "Activates a repo" , ) command_group = command . add_argument_group ( "Arguments" ) command_group . add_argument ( "name" , type = str , help = "Name of the repo to activate" , ) command . set_defaults ( func = api . Repo . activate ) add_help ( command ) f_activate ( ) add ( ) clear ( ) f_list ( ) add_help ( subparser )
Parse the "repo" argument
Parse the " repo " argument
"""
    Parse the "repo" argument

    Args:
        parser (argparse._SubParserAction): The parser object
    """ # def remove(): #     command = subsubparser.add_parser( #         "remove", #         help="Remove an env", #         add_help=False, #         description="Removes an env", #     ) #     command_group = command.add_argument_group("Arguments") #     command_group.add_argument("name", type=str, help="Name of env to remove") #     command.set_defaults(func=api.Env.remove) #     add_help(command) # def edit(): #     command = subsubparser.add_parser( #         "edit", #         help="Edit an env", #         add_help=False, #         description="Edits an env elements", #     ) #     command_group = command.add_argument_group("Arguments") #     command_group.add_argument("name", type=str, help="Name of env") #     command_group.add_argument("cad", type=str, help="CAD tool") #     command_group.add_argument("sim", type=str, help="Sim tool") #     command_group.add_argument("hls", type=str, help="HLS tool") #     command_group.add_argument("repo", type=str, help="Repository") #     command_group.add_argument("board", type=str, help="Board") #     command.set_defaults(func=api.Env.edit) #     add_help(command)
parser
The parser object
The parser object