      def build_options(self):
          """ Get the commands that belong to each category """
          for category in self.categories:
              logger.debug("Building '%s'", category)
              src = ToolsCli if category == "tools" else cli
              mod_classes = self.get_cli_classes(src)
              self.commands[category] = self.sort_commands(category, mod_classes)
              self.opts.update(self.extract_options(src, mod_classes))
              logger.debug("Built '%s'", category)
  
      @staticmethod
      def get_cli_classes(cli_source):
          """ Parse the cli scripts for the argument classes """
 
</s> remove         mod_classes = list()
 </s> add         mod_classes = [] </s> remove         src = "tools" if cmd == "tools.py" else "scripts"
 </s> add         src = "tools.{}".format(self.command.lower()) if cmd == "tools.py" else "scripts" </s> remove     exit(0)
 </s> add     sys.exit(0)


def _get_cli_opts():
    """ Optain the subparsers and cli options for available tools """
    base_path = os.path.realpath(os.path.dirname(sys.argv[0]))
    tools_dir = os.path.join(base_path, "tools")
    for tool_name in sorted(os.listdir(tools_dir)):
        cli_file = os.path.join(tools_dir, tool_name, "cli.py")
        if os.path.exists(cli_file):
            mod = ".".join(("tools", tool_name, "cli"))
            module = import_module(mod)
            cliarg_class = getattr(module, "{}Args".format(tool_name.title()))
            help_text = getattr(module, "_HELPTEXT")
            yield tool_name, help_text, cliarg_class </s> remove             elif optval == "True":
 </s> add             if optval == "True":
            if category == "tools":
                mod_classes = self._get_tools_cli_classes()
                self.commands[category] = self.sort_commands(category, mod_classes)
                for tool in sorted(mod_classes):
                    self.opts.update(self.extract_options(mod_classes[tool], [tool]))
            else:
                mod_classes = self.get_cli_classes(cli)
                self.commands[category] = self.sort_commands(category, mod_classes)
                self.opts.update(self.extract_options(cli, mod_classes))
      def build_options(self):
          """ Get the commands that belong to each category """
          for category in self.categories:
              logger.debug("Building '%s'", category)
            if category == "tools":
                mod_classes = self._get_tools_cli_classes()
                self.commands[category] = self.sort_commands(category, mod_classes)
                for tool in sorted(mod_classes):
                    self.opts.update(self.extract_options(mod_classes[tool], [tool]))
            else:
                mod_classes = self.get_cli_classes(cli)
                self.commands[category] = self.sort_commands(category, mod_classes)
                self.opts.update(self.extract_options(cli, mod_classes))
            if category == "tools":
                mod_classes = self._get_tools_cli_classes()
                self.commands[category] = self.sort_commands(category, mod_classes)
                for tool in sorted(mod_classes):
                    self.opts.update(self.extract_options(mod_classes[tool], [tool]))
            else:
                mod_classes = self.get_cli_classes(cli)
                self.commands[category] = self.sort_commands(category, mod_classes)
                self.opts.update(self.extract_options(cli, mod_classes))
            if category == "tools":
                mod_classes = self._get_tools_cli_classes()
                self.commands[category] = self.sort_commands(category, mod_classes)
                for tool in sorted(mod_classes):
                    self.opts.update(self.extract_options(mod_classes[tool], [tool]))
            else:
                mod_classes = self.get_cli_classes(cli)
                self.commands[category] = self.sort_commands(category, mod_classes)
                self.opts.update(self.extract_options(cli, mod_classes))
            if category == "tools":
                mod_classes = self._get_tools_cli_classes()
                self.commands[category] = self.sort_commands(category, mod_classes)
                for tool in sorted(mod_classes):
                    self.opts.update(self.extract_options(mod_classes[tool], [tool]))
            else:
                mod_classes = self.get_cli_classes(cli)
                self.commands[category] = self.sort_commands(category, mod_classes)
                self.opts.update(self.extract_options(cli, mod_classes))
              logger.debug("Built '%s'", category)
  
      @staticmethod
      def get_cli_classes(cli_source):
          """ Parse the cli scripts for the argument classes """
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Tools Restructure (#990)

* Restructure tools to allow dynamic (plugable) loading

* Update gui cli parsing to allow new tools structure 
lib/gui/options.py