# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

V__UPDATE_AFNI_BINARIES_METADATA = Metadata(
    id="1188231a95870386895c303bd78dc5e7a691fcb6.boutiques",
    name="@update.afni.binaries",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class VUpdateAfniBinariesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__update_afni_binaries(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def v__update_afni_binaries(
    defaults_flag: bool = False,
    help_flag: bool = False,
    help_sys_progs_flag: bool = False,
    apsearch: str | None = None,
    bindir: str | None = None,
    curl_flag: bool = False,
    do_dotfiles_flag: bool = False,
    do_extras_flag: bool = False,
    echo_flag: bool = False,
    make_backup: str | None = None,
    no_cert_verify_flag: bool = False,
    no_recur_flag: bool = False,
    proto: str | None = None,
    quick_flag: bool = False,
    show_obsoletes_flag: bool = False,
    show_obsoletes_grep_flag: bool = False,
    show_system_progs_flag: bool = False,
    sys_ok_flag: bool = False,
    test_flag: bool = False,
    test_protos_flag: bool = False,
    revert_flag: bool = False,
    local_package: str | None = None,
    prog_list: list[str] | None = None,
    package: str | None = None,
    runner: Runner | None = None,
) -> VUpdateAfniBinariesOutputs:
    """
    Install or update AFNI binaries.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/@update.afni.binaries.html
    
    Args:
        defaults_flag: Install current package into abin.
        help_flag: Show this help.
        help_sys_progs_flag: List system programs that block update.
        apsearch: Specify getting apsearch updates.
        bindir: Set AFNI binary directory to ABIN.
        curl_flag: Default to curl instead of wget.
        do_dotfiles_flag: Try to initialize dot files if needed.
        do_extras_flag: Do extra niceties (beyond simple install).
        echo_flag: Turn on shell command echo.
        make_backup: Make a backup of binaries before replacing.
        no_cert_verify_flag: Do not verify the server CA certificate.
        no_recur_flag: Do not download and run new @uab script.
        proto: Access afni host via specified PROTOCOL.
        quick_flag: Quick mode, no fancies.
        show_obsoletes_flag: List any obsolete packages.
        show_obsoletes_grep_flag: List any obsolete packages (easy to grep).
        show_system_progs_flag: Show system programs that do not belong in\
            abin.
        sys_ok_flag: OK to update, even if system progs found.
        test_flag: Just attempt the download and quit.
        test_protos_flag: Test download protocols and exit.
        revert_flag: Revert binaries to previous version.
        local_package: Install local PACKAGE.tgz package.
        prog_list: Install given programs, not whole PACKAGE.
        package: Install distribution package PACKAGE.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VUpdateAfniBinariesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__UPDATE_AFNI_BINARIES_METADATA)
    cargs = []
    cargs.append("@update.afni.binaries")
    if defaults_flag:
        cargs.append("-defaults")
    if help_flag:
        cargs.append("-help")
    if help_sys_progs_flag:
        cargs.append("-help_sys_progs")
    if apsearch is not None:
        cargs.extend([
            "-apsearch",
            apsearch
        ])
    if bindir is not None:
        cargs.extend([
            "-bindir",
            bindir
        ])
    if curl_flag:
        cargs.append("-curl")
    if do_dotfiles_flag:
        cargs.append("-do_dotfiles")
    if do_extras_flag:
        cargs.append("-do_extras")
    if echo_flag:
        cargs.append("-echo")
    if make_backup is not None:
        cargs.extend([
            "-make_backup",
            make_backup
        ])
    if no_cert_verify_flag:
        cargs.append("-no_cert_verify")
    if no_recur_flag:
        cargs.append("-no_recur")
    if proto is not None:
        cargs.extend([
            "-proto",
            proto
        ])
    if quick_flag:
        cargs.append("-quick")
    if show_obsoletes_flag:
        cargs.append("-show_obsoletes")
    if show_obsoletes_grep_flag:
        cargs.append("-show_obsoletes_grep")
    if show_system_progs_flag:
        cargs.append("-show_system_progs")
    if sys_ok_flag:
        cargs.append("-sys_ok")
    if test_flag:
        cargs.append("-test")
    if test_protos_flag:
        cargs.append("-test_protos")
    if revert_flag:
        cargs.append("-revert")
    if local_package is not None:
        cargs.extend([
            "-local_package",
            local_package
        ])
    if prog_list is not None:
        cargs.extend([
            "-prog_list",
            *prog_list
        ])
    if package is not None:
        cargs.extend([
            "-package",
            package
        ])
    ret = VUpdateAfniBinariesOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VUpdateAfniBinariesOutputs",
    "V__UPDATE_AFNI_BINARIES_METADATA",
    "v__update_afni_binaries",
]
