docs: def cli(
          template_variables, template, output, variables, extensions,
          encoding, include_path, no_variable_file, no_extension_file,
          no_trim_blocks, no_lstrip_blocks, remove_trailing_newline,
          mode, m, md):
      """Reads the given Jinja TEMPLATE and renders its content
      into a new file. For example, a template called 'foo.c.j2'
      will be written into 'foo.c' in case the output file is not
      explicitly given.
  
      Template variables can be defined in a separate file or
      given as part of the command-line call, e.g.
  
          yasha --hello=world -o output.txt template.j2
  
      defines a variable 'hello' for a template like:
  
          Hello {{ hello }} !
      """
  
      # Set the encoding of the template file
      if encodings.search_function(encoding) is None:
          msg = "Unrecognized encoding name '{}'"
          raise ClickException(msg.format(encoding))
      yasha.ENCODING = encoding
  
      # Append include path of referenced templates
      include_path = [os.path.dirname(template.name)] + list(include_path)
  
      if not extensions or not variables:
          template_companion = yasha.find_template_companion(template.name)
          template_companion = list(template_companion)
  
      if not extensions and not no_extension_file:
          for file in template_companion:
              if file.endswith(yasha.EXTENSION_FILE_FORMATS):
                  extensions = click.open_file(file, "rb")
                  break
  
      if extensions:
          load_extensions(extensions)
  
      if not variables and not no_variable_file:
          for file in template_companion:
              if file.endswith(tuple(PARSERS.keys())):
                  variables = (click.open_file(file, "rb"),)
                  break
  
      if not output:
          if template.name == "<stdin>":
              output = click.open_file("-", "wb")
          else:
              output = os.path.splitext(template.name)[0]
              output = click.open_file(output, "wb", lazy=True)
  
      if m or md:
          deps = [os.path.relpath(template.name)]
          for file in variables:
              deps.append(os.path.relpath(file.name))
          if extensions:
              deps.append(os.path.relpath(extensions.name))
          for d in yasha.find_referenced_templates(template, include_path):
              deps.append(os.path.relpath(d))
  
          deps = os.path.relpath(output.name) + ": " + " ".join(deps)
          if m:
              click.echo(deps)
              return  # Template won't be rendered
          if md:
              deps += os.linesep
              output_d = click.open_file(output.name + ".d", "wb")
              output_d.write(deps.encode(yasha.ENCODING))
  
      # Load Jinja
      jinja = yasha.load_jinja(
          path=include_path,
          tests=TESTS,
          filters=FILTERS,
          classes=CLASSES,
          mode=mode,
          trim_blocks=not no_trim_blocks,
          lstrip_blocks=not no_lstrip_blocks,
          keep_trailing_newline=not remove_trailing_newline
     )
  
      # Get template
      if template.name == "<stdin>":
          stdin = template.read()
          t = jinja.from_string(stdin.decode(yasha.ENCODING))
      else:
          t = jinja.get_template(os.path.basename(template.name))
  
      # Parse variables
      context = dict()
      for file in variables:
          context.update(parse_variable_file(file))
      context.update(yasha.parse_cli_variables(template_variables))
  
      # Finally render template and save it
      try:
          t_stream = t.stream(context)
          t_stream.enable_buffering(size=5)
          t_stream.dump(output, encoding=yasha.ENCODING)
      except JinjaUndefinedError as e:
          raise ClickException("Variable {}".format(e))