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

import typing
import pathlib
from styxdefs import *
import dataclasses

STRBLAST_METADATA = Metadata(
    id="a2cee2c629b430408b17d4c3a5b48c6d60070e17.boutiques",
    name="strblast",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def strblast(
    targetstring: str,
    input_files: list[InputPathType],
    new_char: str | None = None,
    new_string: str | None = None,
    unescape: bool = False,
    quiet: bool = False,
    help_: bool = False,
    runner: Runner | None = None,
) -> StrblastOutputs:
    """
    Finds exact copies of the target string in each of the input files, and replaces
    all characters with some junk string.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        targetstring: Target string to search for in the input files.
        input_files: Input files to search for the target string.
        new_char: Replace TARGETSTRING with CHAR (repeated).
        new_string: Replace TARGETSTRING with STRING.
        unescape: Parse TARGETSTRING for escaped characters (includes '\\t',\
            '\\n', '\\r').
        quiet: Do not report files with no strings found. Use -quiet -quiet to\
            avoid any reporting.
        help_: Show help message and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `StrblastOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(STRBLAST_METADATA)
    cargs = []
    cargs.append("strblast")
    cargs.append(targetstring)
    cargs.extend([execution.input_file(f) for f in input_files])
    if new_char is not None:
        cargs.extend([
            "-new_char",
            new_char
        ])
    if new_string is not None:
        cargs.extend([
            "-new_string",
            new_string
        ])
    if unescape:
        cargs.append("-unescape")
    if quiet:
        cargs.append("-quiet")
    if help_:
        cargs.append("-help")
    ret = StrblastOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "STRBLAST_METADATA",
    "StrblastOutputs",
    "strblast",
]
