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

import typing
import pathlib
from styxdefs import *
import dataclasses

PLUGOUT_DRIVE_METADATA = Metadata(
    id="22300b13070d9730d869d6a2398b779c0bc9a168.boutiques",
    name="plugout_drive",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def plugout_drive(
    host: str | None = None,
    verbose: bool = False,
    port: float | None = None,
    maxwait: float | None = None,
    name: str | None = None,
    command: list[str] | None = None,
    quit_: bool = False,
    runner: Runner | None = None,
) -> PlugoutDriveOutputs:
    """
    This program connects to AFNI and sends commands that the user specifies
    interactively or on command line over to AFNI to be executed.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/plugout_drive.html
    
    Args:
        host: Connect to AFNI running on the specified host using TCP/IP.\
            Default is 'localhost'.
        verbose: Verbose mode.
        port: Use TCP/IP port number. Default is 8099.
        maxwait: Maximum wait time in seconds for AFNI to connect. Default is 9\
            seconds.
        name: Name that AFNI assigns to this plugout. Default is a pre-defined\
            name.
        command: Command to be executed on AFNI. Example: '-com "SET_FUNCTION\
            SomeFunction"'.
        quit_: Quit after executing all -com commands. Default is to wait for\
            more commands.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PlugoutDriveOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(PLUGOUT_DRIVE_METADATA)
    cargs = []
    cargs.append("plugout_drive")
    if host is not None:
        cargs.extend([
            "-host",
            host
        ])
    if verbose:
        cargs.append("-v")
    if port is not None:
        cargs.extend([
            "-port",
            str(port)
        ])
    if maxwait is not None:
        cargs.extend([
            "-maxwait",
            str(maxwait)
        ])
    if name is not None:
        cargs.extend([
            "-name",
            name
        ])
    if command is not None:
        cargs.extend([
            "-com",
            *command
        ])
    if quit_:
        cargs.append("-quit")
    ret = PlugoutDriveOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PLUGOUT_DRIVE_METADATA",
    "PlugoutDriveOutputs",
    "plugout_drive",
]
