# Path: dotbot/config.py
# class ConfigReader(object):
#     def __init__(self, config_file_path):
#         self._config = self._read(config_file_path)
# 
#     def _read(self, config_file_path):
#         try:
#             _, ext = os.path.splitext(config_file_path)
#             with open(config_file_path) as fin:
#                 if ext == ".json":
#                     data = json.load(fin)
#                 else:
#                     data = yaml.safe_load(fin)
#             return data
#         except Exception as e:
#             msg = string.indent_lines(str(e))
#             raise ReadingError("Could not read config file:\n%s" % msg)
# 
#     def get_config(self):
#         return self._config
# 
# class ReadingError(Exception):
#     pass
# 
# Path: dotbot/dispatcher.py
# class Dispatcher(object):
#     def __init__(
#         self, base_directory, only=None, skip=None, exit_on_failure=False, options=Namespace()
#     ):
#         self._log = Messenger()
#         self._setup_context(base_directory, options)
#         self._load_plugins()
#         self._only = only
#         self._skip = skip
#         self._exit = exit_on_failure
# 
#     def _setup_context(self, base_directory, options):
#         path = os.path.abspath(os.path.expanduser(base_directory))
#         if not os.path.exists(path):
#             raise DispatchError("Nonexistent base directory")
#         self._context = Context(path, options)
# 
#     def dispatch(self, tasks):
#         success = True
#         for task in tasks:
#             for action in task:
#                 if (
#                     self._only is not None
#                     and action not in self._only
#                     or self._skip is not None
#                     and action in self._skip
#                 ) and action != "defaults":
#                     self._log.info("Skipping action %s" % action)
#                     continue
#                 handled = False
#                 if action == "defaults":
#                     self._context.set_defaults(task[action])  # replace, not update
#                     handled = True
#                     # keep going, let other plugins handle this if they want
#                 for plugin in self._plugins:
#                     if plugin.can_handle(action):
#                         try:
#                             local_success = plugin.handle(action, task[action])
#                             if not local_success and self._exit:
#                                 # The action has failed exit
#                                 self._log.error("Action %s failed" % action)
#                                 return False
#                             success &= local_success
#                             handled = True
#                         except Exception as err:
#                             self._log.error(
#                                 "An error was encountered while executing action %s" % action
#                             )
#                             self._log.debug(err)
#                             if self._exit:
#                                 # There was an execption exit
#                                 return False
#                 if not handled:
#                     success = False
#                     self._log.error("Action %s not handled" % action)
#                     if self._exit:
#                         # Invalid action exit
#                         return False
#         return success
# 
#     def _load_plugins(self):
#         self._plugins = [plugin(self._context) for plugin in Plugin.__subclasses__()]
# 
# class DispatchError(Exception):
#     pass
# 
# Path: dotbot/util/module.py
# def load(path):
#     def load_module(module_name, path):
#     def load_module(module_name, path):
#     def load_module(module_name, path):


import os, glob
import sys
import dotbot
import os
import subprocess
from argparse import ArgumentParser, RawTextHelpFormatter
from .config import ConfigReader, ReadingError
from .dispatcher import Dispatcher, DispatchError
from .messenger import Messenger
from .messenger import Level
from .util import module
            from .plugins import Clean, Create, Link, Shell
                hash_msg = ""
            print("Dotbot version %s%s" % (dotbot.__version__, hash_msg))
            exit(0)
        if options.super_quiet:
            log.set_level(Level.WARNING)
        if options.quiet:
            log.set_level(Level.INFO)
        if options.verbose > 0:
            log.set_level(Level.DEBUG)

        if options.force_color and options.no_color:
            log.error("`--force-color` and `--no-color` cannot both be provided")
            exit(1)
        elif options.force_color:
            log.use_color(True)
        elif options.no_color:
            log.use_color(False)
        else:
            log.use_color(sys.stdout.isatty())

        plugin_directories = list(options.plugin_dirs)
        if not options.disable_built_in_plugins:
        plugin_paths = []
        for directory in plugin_directories:
            for plugin_path in glob.glob(os.path.join(directory, "*.py")):
                plugin_paths.append(plugin_path)
        for plugin_path in options.plugins:
            plugin_paths.append(plugin_path)
        for plugin_path in plugin_paths:
            abspath = os.path.abspath(plugin_path)

# Path: dotbot/config.py
# class ConfigReader(object):
#     def __init__(self, config_file_path):
#         self._config = self._read(config_file_path)
# 
#     def _read(self, config_file_path):
#         try:
#             _, ext = os.path.splitext(config_file_path)
#             with open(config_file_path) as fin:
#                 if ext == ".json":
#                     data = json.load(fin)
#                 else:
#                     data = yaml.safe_load(fin)
#             return data
#         except Exception as e:
#             msg = string.indent_lines(str(e))
#             raise ReadingError("Could not read config file:\n%s" % msg)
# 
#     def get_config(self):
#         return self._config
# 
# class ReadingError(Exception):
#     pass
# 
# Path: dotbot/dispatcher.py
# class Dispatcher(object):
#     def __init__(
#         self, base_directory, only=None, skip=None, exit_on_failure=False, options=Namespace()
#     ):
#         self._log = Messenger()
#         self._setup_context(base_directory, options)
#         self._load_plugins()
#         self._only = only
#         self._skip = skip
#         self._exit = exit_on_failure
# 
#     def _setup_context(self, base_directory, options):
#         path = os.path.abspath(os.path.expanduser(base_directory))
#         if not os.path.exists(path):
#             raise DispatchError("Nonexistent base directory")
#         self._context = Context(path, options)
# 
#     def dispatch(self, tasks):
#         success = True
#         for task in tasks:
#             for action in task:
#                 if (
#                     self._only is not None
#                     and action not in self._only
#                     or self._skip is not None
#                     and action in self._skip
#                 ) and action != "defaults":
#                     self._log.info("Skipping action %s" % action)
#                     continue
#                 handled = False
#                 if action == "defaults":
#                     self._context.set_defaults(task[action])  # replace, not update
#                     handled = True
#                     # keep going, let other plugins handle this if they want
#                 for plugin in self._plugins:
#                     if plugin.can_handle(action):
#                         try:
#                             local_success = plugin.handle(action, task[action])
#                             if not local_success and self._exit:
#                                 # The action has failed exit
#                                 self._log.error("Action %s failed" % action)
#                                 return False
#                             success &= local_success
#                             handled = True
#                         except Exception as err:
#                             self._log.error(
#                                 "An error was encountered while executing action %s" % action
#                             )
#                             self._log.debug(err)
#                             if self._exit:
#                                 # There was an execption exit
#                                 return False
#                 if not handled:
#                     success = False
#                     self._log.error("Action %s not handled" % action)
#                     if self._exit:
#                         # Invalid action exit
#                         return False
#         return success
# 
#     def _load_plugins(self):
#         self._plugins = [plugin(self._context) for plugin in Plugin.__subclasses__()]
# 
# class DispatchError(Exception):
#     pass
# 
# Path: dotbot/util/module.py
# def load(path):
#     def load_module(module_name, path):
#     def load_module(module_name, path):
#     def load_module(module_name, path):


# Path: dotbot/cli.py
import os, glob
import sys
import dotbot
import os
import subprocess
from argparse import ArgumentParser, RawTextHelpFormatter
from .config import ConfigReader, ReadingError
from .dispatcher import Dispatcher, DispatchError
from .messenger import Messenger
from .messenger import Level
from .util import module
            from .plugins import Clean, Create, Link, Shell

                hash_msg = ""
            print("Dotbot version %s%s" % (dotbot.__version__, hash_msg))
            exit(0)
        if options.super_quiet:
            log.set_level(Level.WARNING)
        if options.quiet:
            log.set_level(Level.INFO)
        if options.verbose > 0:
            log.set_level(Level.DEBUG)

        if options.force_color and options.no_color:
            log.error("`--force-color` and `--no-color` cannot both be provided")
            exit(1)
        elif options.force_color:
            log.use_color(True)
        elif options.no_color:
            log.use_color(False)
        else:
            log.use_color(sys.stdout.isatty())

        plugin_directories = list(options.plugin_dirs)
        if not options.disable_built_in_plugins:
        plugin_paths = []
        for directory in plugin_directories:
            for plugin_path in glob.glob(os.path.join(directory, "*.py")):
                plugin_paths.append(plugin_path)
        for plugin_path in options.plugins:
            plugin_paths.append(plugin_path)
        for plugin_path in plugin_paths:
            abspath = os.path.abspath(plugin_path)

            module.load(abspath)