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

import typing
import pathlib
from styxdefs import *
import dataclasses

FNAME2EXT_METADATA = Metadata(
    id="d737533f13debab7b8cdf915ca9c4aa939e7445c.boutiques",
    name="fname2ext",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class Fname2extOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fname2ext(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    file_extension: OutputPathType
    """Extracted file extension"""


def fname2ext(
    filename: str,
    runner: Runner | None = None,
) -> Fname2extOutputs:
    """
    Converts the name of a file to its extension.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        filename: The name of the file for which to extract the extension. The\
            file does not need to exist.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Fname2extOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FNAME2EXT_METADATA)
    cargs = []
    cargs.append("fname2ext")
    cargs.append(filename)
    ret = Fname2extOutputs(
        root=execution.output_file("."),
        file_extension=execution.output_file("extension.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FNAME2EXT_METADATA",
    "Fname2extOutputs",
    "fname2ext",
]
