def METHOD_NAME(workspace_name="drake"):
    # Slice out our overlay command-line argument "--all".
    argv = sys.argv[1:]
    find_all = False
    if "--all" in argv:
        find_all = True
        argv.remove("--all")
    # Find the wrapped tool.
    tool_cmds = _make_buildifier_command()
    # Process --help.
    if "--help" in argv or "-help" in argv:
        return _help(tool_cmds + argv)
    # Process --all.
    has_files = len([x for x in argv if not x.startswith("-")]) > 0
    if find_all and has_files:
        print("ERROR: cannot combine single inputs with '--all'")
        return 1
    if not find_all and not has_files:
        print("ERROR: no input files; did you want '--all'?")
        return 1
    if find_all:
        workspace_dir, found = _find_buildifier_sources(workspace_name)
        if len(found) == 0:
            print("ERROR: '--all' could not find anything")
            return 1
        print(f"This will reformat {len(found)} files "
              f"within {workspace_dir}")
        if input("Are you sure [y/N]? ") not in ["y", "Y"]:
            print("... canceled")
            sys.exit(1)
        argv.extend(found)
    # Provide helpful diagnostics when in check mode.  Buildifier's -mode=check
    # uses exitcode 0 even when lint exists; we use whether or not its output
    # was empty to tell whether there was lint.
    if "-mode=check" in argv or "--mode=check" in argv:
        if _passes_check_mode(tool_cmds + argv):
            return 0
        switches = [x for x in argv if x.startswith("-")]
        files = [x for x in argv if not x.startswith("-")]
        print("ERROR: buildifier: the required formatting is incorrect")
        for one_file in files:
            if not _passes_check_mode(tool_cmds + switches + [one_file]):
                print("ERROR: %s:1: error: %s" % (
                    one_file, "the required formatting is incorrect"))
                print("ERROR: %s:1: note: fix via %s %s" % (
                    one_file, "bazel-bin/tools/lint/buildifier", one_file))
                print(("ERROR: %s:1: note: if that program does not exist, "
                       "you might need to compile it first: "
                       "bazel build //tools/lint/...") %
                      one_file)
        print("NOTE: see https://drake.mit.edu/bazel.html#buildifier")
        return 1
    # In fix mode, disallow running from within the Bazel sandbox.
    if "-mode=diff" not in argv and "--mode=diff" not in argv:
        if os.getcwd().endswith(".runfiles/drake"):
            print("ERROR: do not use 'bazel run' for buildifier in fix mode")
            print("ERROR: use bazel-bin/tools/lint/buildifier instead")
            return 1
    # In fix or diff mode, just let buildifier do its thing.
    return subprocess.call(tool_cmds + argv)