# Buggy code
def main():
    """CLI Entrypoint"""
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()

    apply_parser = subparsers.add_parser(
        "apply", help="Applies a config bundle's patches to the specified source tree"
    )
    apply_parser.add_argument(
        "--patch-bin",
        help="The GNU patch command to use. Omit to find it automatically.",
    )
    apply_parser.add_argument(
        "target", type=Path, help="The directory tree to apply patches onto."
    )
    apply_parser.add_argument(
        "patches",
        type=Path,
        nargs="+",
        help="The directories containing patches to apply. They must be in GNU quilt format",
    )
    apply_parser.set_defaults(callback=_apply_callback)

    merge_parser = subparsers.add_parser(
        "merge", help="Merges patches directories in GNU quilt format"
    )
    merge_parser.add_argument(
        "--prepend",
        "-p",
        action="store_true",
        help=(
            'If "destination" exists, prepend patches from sources into it.'
            " By default, merging will fail if the destination already exists."
        ),
    )
    merge_parser.add_argument(
        "destination",
        type=Path,
        help=(
            "The directory to write the merged patches to. "
            "The destination must not exist unless --prepend is specified."
        ),
    )
    merge_parser.add_argument(
        "source", type=Path, nargs="+", help="The GNU quilt patches to merge."
    )
    merge_parser.set_defaults(callback=_merge_callback)

    args = parser.parse_args()
    args.callback(args)


# Traceback (FileNotFoundError)
[/tmp/download]: rm -rf *
[/tmp/download]: git clone https://github.com/Eloston/ungoogled-chromium.git
Cloning into 'ungoogled-chromium'...
remote: Enumerating objects: 189, done.
remote: Counting objects: 100% (189/189), done.
remote: Compressing objects: 100% (146/146), done.
remote: Total 11664 (delta 67), reused 121 (delta 36), pack-reused 11475
Receiving objects: 100% (11664/11664), 6.10 MiB | 6.82 MiB/s, done.
Resolving deltas: 100% (7301/7301), done.
[/tmp/download]: cd ungoogled-chromium/
[/tmp/download/ungoogled-chromium]: ./utils/downloads.py retrieve -c build/downloads_cache -i downloads.ini
Traceback (most recent call last):
File "./utils/downloads.py", line 393, in <module>
main()
File "./utils/downloads.py", line 389, in main
args.callback(args)
File "./utils/downloads.py", line 330, in _retrieve_callback
DownloadInfo(args.ini), args.cache, args.show_progress, args.disable_ssl_verification)
File "./utils/downloads.py", line 236, in retrieve_downloads
raise FileNotFoundError(cache_dir)
FileNotFoundError: build/downloads_cache
[/tmp/download/ungoogled-chromium]:

# Fixed code
def main():
    """CLI Entrypoint"""
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()

    apply_parser = subparsers.add_parser(
        "apply",
        help="Applies patches (in GNU Quilt format) to the specified source tree",
    )
    apply_parser.add_argument(
        "--patch-bin",
        help="The GNU patch command to use. Omit to find it automatically.",
    )
    apply_parser.add_argument(
        "target", type=Path, help="The directory tree to apply patches onto."
    )
    apply_parser.add_argument(
        "patches",
        type=Path,
        nargs="+",
        help="The directories containing patches to apply. They must be in GNU quilt format",
    )
    apply_parser.set_defaults(callback=_apply_callback)

    merge_parser = subparsers.add_parser(
        "merge", help="Merges patches directories in GNU quilt format"
    )
    merge_parser.add_argument(
        "--prepend",
        "-p",
        action="store_true",
        help=(
            'If "destination" exists, prepend patches from sources into it.'
            " By default, merging will fail if the destination already exists."
        ),
    )
    merge_parser.add_argument(
        "destination",
        type=Path,
        help=(
            "The directory to write the merged patches to. "
            "The destination must not exist unless --prepend is specified."
        ),
    )
    merge_parser.add_argument(
        "source", type=Path, nargs="+", help="The GNU quilt patches to merge."
    )
    merge_parser.set_defaults(callback=_merge_callback)

    args = parser.parse_args()
    args.callback(args)