docs: def parse_commandline(argv):
    """
    Returns the arguments parsed from *argv* as a namespace.
  
    """
    ap = ArgumentParser(
      prog='wdiffhtml',
      description=DESCRIPTION,
      epilog=EPILOG,
    )
    ap.add_argument(
      '--version', action='version', version='wdiffhtml v{}'.format(version),
      help="shows version and exits"
    )
    ap.add_argument(
      'org_file', metavar='FILENAME',
      help="original file"
    )
    ap.add_argument(
      'new_file', metavar='FILENAME',
      help="changed file"
    )
    g_html = ap.add_argument_group(
      'Wrapper',
      "Without these settings, only the `wdiff` output is returned (with INS "
      "and DEL tags). Here are some options to wrap the output in a HTML "
      "document."
    )
    g_html.add_argument(
      '-w', '--wrap-with-html', action='store_true',
      help="wrap the diff with a HTML document"
    )
    g_html.add_argument(
      '-f', '--fold-tags', action='store_true',
      help="allow INS and DEL tags to span linebraks"
    )
    g_html.add_argument(
      '-b', '--hard-breaks', action='store_true',
      help="replace line breaks with BR tags"
    )
    g_context = ap.add_argument_group(
      'Context',
      "With these options you can add additional information to the HTML "
      "output (means these only work alongside the `--wrap-with-html` option)."
    )
    g_context.add_argument(
      '-r', '--revision', metavar='STRING',
      help="add a revision tag or version number to the output"
    )
    x_stamp = g_context.add_mutually_exclusive_group()
    x_stamp.add_argument(
      '-d', '--datestamp', action='store_true',
      help="add a date to the output (UTC now)"
    )
    x_stamp.add_argument(
      '-D', '--timestamp', action='store_true',
      help="add date and time to the output (UTC now)"
    )
    g_files = ap.add_argument_group(
      'Files',
      "Instead of using the default templates, you can use your own files. "
      "These only work alongside the `--wrap-with-html` option"
    )
    g_files.add_argument(
      '-t', '--template', type=FileType('r'), metavar='FILE',
      help="load the Jinja2 template from this file"
    )
    g_files.add_argument(
      '-c', '--css', type=FileType('r'), metavar='FILE',
      help="load CSS from this file"
    )
    g_files.add_argument(
      '-j', '--js', type=FileType('r'), metavar='FILE',
      help="load Javascript from this file"
    )
    g_files.add_argument(
      '-J', '--js2', type=FileType('r'), metavar='FILE',
      help="load another Javascript from this file (like Zepto)"
    )
    # parse args
    args = ap.parse_args(argv)
    # check for wrapper
    if not args.wrap_with_html:
      # check context arguments and file arguments
      for group in (g_context, g_files):
        args_to_check = [opt.dest for opt in group._group_actions]
        if any([getattr(args, attr) for attr in args_to_check]):
          msg = "the options require that `--wrap-with-html` is used"
          ap.error(msg)
    return args