  
  def bad_args(args):  # pylint:disable=unused-argument
      """ Print help on bad arguments """
      PARSER.print_help()
      exit(0)
  
  
  if __name__ == "__main__":
      _TOOLS_WARNING = "Please backup your data and/or test the tool you want "
      _TOOLS_WARNING += "to use with a smaller data set to make sure you "
 
</s> remove     ALIGN = cli.AlignmentsArgs(SUBPARSER,
                               "alignments",
                               "This command lets you perform various tasks pertaining to an "
                               "alignments file.")
    PREVIEW = cli.PreviewArgs(SUBPARSER,
                              "preview",
                              "This command allows you to preview swaps to tweak convert "
                              "settings.")
    EFFMPEG = cli.EffmpegArgs(SUBPARSER,
                              "effmpeg",
                              "This command allows you to easily execute common ffmpeg tasks.")
    MASK = cli.MaskArgs(SUBPARSER,
                        "mask",
                        "This command lets you generate masks for existing alignments.")
    RESTORE = cli.RestoreArgs(SUBPARSER,
                              "restore",
                              "This command lets you restore models from backup.")
    SORT = cli.SortArgs(SUBPARSER,
                        "sort",
                        "This command lets you sort images using various methods.")
 </s> add     for tool, helptext, cli_args in _get_cli_opts():
        cli_args(SUBPARSER, tool, helptext) </s> remove             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))
 </s> add             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)) </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         mod_classes = list()
 </s> add         mod_classes = []
    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
  
  def bad_args(args):  # pylint:disable=unused-argument
      """ Print help on bad arguments """
      PARSER.print_help()
    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
  
  
  if __name__ == "__main__":
      _TOOLS_WARNING = "Please backup your data and/or test the tool you want "
      _TOOLS_WARNING += "to use with a smaller data set to make sure you "
keep keep keep keep 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 
tools.py