def get_verbosity_subcommand() -> dict:
    """Parse command line arguments for verbosity and subcommand.

    Returns:
        dict: Dictionary containing:
            - subcommand: The subcommand being run
            - help: Whether help was requested
            - verbosity: Verbosity level (0-2)

    Example:
        >>> import sys
        >>> sys.argv = ['anomalib', 'train', '-h', '-v']
        >>> get_verbosity_subcommand()
        {'subcommand': 'train', 'help': True, 'verbosity': 1}
    """
    arguments: dict = {"subcommand": None, "help": False, "verbosity": 2}
    if len(sys.argv) >= 2 and sys.argv[1] not in {"--help", "-h"}:
        arguments["subcommand"] = sys.argv[1]
    if "--help" in sys.argv or "-h" in sys.argv:
        arguments["help"] = True
        if arguments["subcommand"] in REQUIRED_ARGUMENTS:
            arguments["verbosity"] = 0
            if "-v" in sys.argv or "--verbose" in sys.argv:
                arguments["verbosity"] = 1
            if "-vv" in sys.argv:
                arguments["verbosity"] = 2
    return arguments
Parse command line arguments for verbosity and subcommand.

    Returns:
        dict: Dictionary containing:
            - subcommand: The subcommand being run
            - help: Whether help was requested
            - verbosity: Verbosity level (0-2)

    Example:
        >>> import sys
        >>> sys.argv = ['anomalib', 'train', '-h', '-v']
        >>> get_verbosity_subcommand()
        {'subcommand': 'train', 'help': True, 'verbosity': 1}
    
src/anomalib/cli/utils/help_formatter.py