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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSVGLRUN_METADATA = Metadata(
    id="5ac643a495dfd3b7b90655e3aff808accc7f76dd.boutiques",
    name="fsvglrun",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def fsvglrun(
    command: str,
    zeroth_arg_name: str | None = None,
    empty_env: bool = False,
    dashed_arg: bool = False,
    command_args: list[str] | None = None,
    runner: Runner | None = None,
) -> FsvglrunOutputs:
    """
    A tool to execute a command, replacing the shell with the specified program,
    typically used within FreeSurfer environment.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        command: The command to be executed, replacing the shell with the\
            specified program.
        zeroth_arg_name: Pass NAME as the zeroth argument to COMMAND.
        empty_env: Execute COMMAND with an empty environment.
        dashed_arg: Place a dash in the zeroth argument to COMMAND.
        command_args: Arguments for the command executed by fsvglrun.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FsvglrunOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSVGLRUN_METADATA)
    cargs = []
    cargs.append("fsvglrun")
    if zeroth_arg_name is not None:
        cargs.extend([
            "-a",
            zeroth_arg_name
        ])
    if empty_env:
        cargs.append("-c")
    if dashed_arg:
        cargs.append("-l")
    cargs.append(command)
    if command_args is not None:
        cargs.extend(command_args)
    ret = FsvglrunOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSVGLRUN_METADATA",
    "FsvglrunOutputs",
    "fsvglrun",
]
