# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):
# 
# Path: pybombs/config_manager.py
# def npath(path):
#     def __init__(self, args, cfg_list, select_prefix=None):
#     def _set_attrs(self):
#     def _merge_config_info_from_file(self, cfg_file, cfg_data):
#     def _find_prefix_dir(self, args):
#     def _detect_python_version(self):
#     def _detect_python_path(self):
#     def _load_environ_from_script(self, setup_env_file):
#     def _load_default_env(self, env):
#     def get_prefix_cfg_dir_writable(self):
#     def __init__(self, select_prefix=None):
#     def load(self, select_prefix=None):
#     def _append_cfg_from_file(self, cfg_filename, index=None):
#     def get_pybombs_dir(self, prefix_dir=None):
#     def get(self, key, default=None):
#     def keys(self):
#     def set(self, key, value):
#     def get_help(self, key):
#     def set_config_reference(self, ref):
#     def get_active_prefix(self):
#     def get_recipe_locations(self):
#     def get_named_recipe_dirs(self):
#     def get_named_recipe_sources(self):
#     def get_named_recipe_cfg_file(self, recipe_alias):
#     def get_template_dir(self):
#     def resolve_recipe_uri(self, uri, name, cache_dir):
#     def get_package_flags(self, pkgname, categoryname=None):
#     def get_python_version(self):
#     def get_satisfier_tags(self):
#     def update_cfg_file(self, new_data, cfg_file=None):
#     def setup_parser(self, parser):
# class PrefixInfo(object):
# class ConfigManager(object):
#     LAYER_DEFAULT = 0
#     LAYER_GLOBALS = 1
#     LAYER_HOME = 2
#     LAYER_PREFIX = 3
#     LAYER_CMDLINE_FILE = 4
#     LAYER_CMDLINE_ARGS = 5
#     LAYER_VOLATILE = 6


import argparse
from six import iteritems
from pybombs import pb_logging
from pybombs.config_manager import config_manager
from pybombs.pb_exception import PBException
            from pybombs import recipe_manager
    from pybombs import commands
                #for args in cmd_info['subparser']:
                    #subparser.add_argument(**args)
            else:
                cmd_info['subparser'](subparser)
        return parser

    def run(self):
        """ Go, go, go! """
        if self.args.sub_command not in self.subcommands:
            self.log.error("Illegal sub-command: `{0}'".format(self.args.sub_command))
            self.log.error("Valid sub-commands are: {0}".format(",".join(self.subcommands.keys())))
            return -1
        return self.subcommands[self.args.sub_command]['run'](self)()

##############################################################################
# Argument Parser
##############################################################################
def init_arg_parser(show_help_for=None, hide_hidden=True):
    """
    Create a base argument parser
    """
    def dummy_error(msg):
        " Bogus error handler for ArgParse in case we don't want all the output."
        raise PBException('parse error')
    cmd_list = get_cmd_list(hide_hidden=hide_hidden)
    # Set up global options:
    parser = argparse.ArgumentParser(
        description='PyBOMBS: A meta-package manager integrated with CGRAN.',
        epilog='Run `pybombs <command> --help to learn about command-specific options.',
    )

# Path: pybombs/pb_logging.py
# BOLD = str('\033[1m')
# TRACE = 1
# class ColoredConsoleHandler(logging.StreamHandler):
# class PBLogger(logging.getLoggerClass()):
#     def emit(self, record):
#     def __init__(self, *args, **kwargs):
#     def trace(self, *args, **kwargs):
# 
# Path: pybombs/config_manager.py
# def npath(path):
#     def __init__(self, args, cfg_list, select_prefix=None):
#     def _set_attrs(self):
#     def _merge_config_info_from_file(self, cfg_file, cfg_data):
#     def _find_prefix_dir(self, args):
#     def _detect_python_version(self):
#     def _detect_python_path(self):
#     def _load_environ_from_script(self, setup_env_file):
#     def _load_default_env(self, env):
#     def get_prefix_cfg_dir_writable(self):
#     def __init__(self, select_prefix=None):
#     def load(self, select_prefix=None):
#     def _append_cfg_from_file(self, cfg_filename, index=None):
#     def get_pybombs_dir(self, prefix_dir=None):
#     def get(self, key, default=None):
#     def keys(self):
#     def set(self, key, value):
#     def get_help(self, key):
#     def set_config_reference(self, ref):
#     def get_active_prefix(self):
#     def get_recipe_locations(self):
#     def get_named_recipe_dirs(self):
#     def get_named_recipe_sources(self):
#     def get_named_recipe_cfg_file(self, recipe_alias):
#     def get_template_dir(self):
#     def resolve_recipe_uri(self, uri, name, cache_dir):
#     def get_package_flags(self, pkgname, categoryname=None):
#     def get_python_version(self):
#     def get_satisfier_tags(self):
#     def update_cfg_file(self, new_data, cfg_file=None):
#     def setup_parser(self, parser):
# class PrefixInfo(object):
# class ConfigManager(object):
#     LAYER_DEFAULT = 0
#     LAYER_GLOBALS = 1
#     LAYER_HOME = 2
#     LAYER_PREFIX = 3
#     LAYER_CMDLINE_FILE = 4
#     LAYER_CMDLINE_ARGS = 5
#     LAYER_VOLATILE = 6


# Path: pybombs/commands/base.py
import argparse
from six import iteritems
from pybombs import pb_logging
from pybombs.config_manager import config_manager
from pybombs.pb_exception import PBException
            from pybombs import recipe_manager
    from pybombs import commands

                #for args in cmd_info['subparser']:
                    #subparser.add_argument(**args)
            else:
                cmd_info['subparser'](subparser)
        return parser

    def run(self):
        """ Go, go, go! """
        if self.args.sub_command not in self.subcommands:
            self.log.error("Illegal sub-command: `{0}'".format(self.args.sub_command))
            self.log.error("Valid sub-commands are: {0}".format(",".join(self.subcommands.keys())))
            return -1
        return self.subcommands[self.args.sub_command]['run'](self)()

##############################################################################
# Argument Parser
##############################################################################
def init_arg_parser(show_help_for=None, hide_hidden=True):
    """
    Create a base argument parser
    """
    def dummy_error(msg):
        " Bogus error handler for ArgParse in case we don't want all the output."
        raise PBException('parse error')
    cmd_list = get_cmd_list(hide_hidden=hide_hidden)
    # Set up global options:
    parser = argparse.ArgumentParser(
        description='PyBOMBS: A meta-package manager integrated with CGRAN.',
        epilog='Run `pybombs <command> --help to learn about command-specific options.',
    )

    config_manager.setup_parser(parser)