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

import typing
import pathlib
from styxdefs import *
import dataclasses

NICCC_METADATA = Metadata(
    id="ecc865fc2143792b2c5c1c0adc6ffbd967c02c7f.boutiques",
    name="niccc",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class NicccOutputs(typing.NamedTuple):
    """
    Output object returned when calling `niccc(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    stderr_output: OutputPathType
    """Results output to stderr"""


def niccc(
    streamspec: str,
    duplicate: bool = False,
    nodata: bool = False,
    attribute: str | None = None,
    match: str | None = None,
    file: bool = False,
    string_: bool = False,
    stdout: bool = False,
    hash_: bool = False,
    quiet: bool = False,
    find_attr: list[str] | None = None,
    skip_attr: list[str] | None = None,
    runner: Runner | None = None,
) -> NicccOutputs:
    """
    A program for conducting certain NIML tests on input from streamspec and write
    the results to stderr.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        streamspec: A string defining a NIML stream.
        duplicate: Duplicate the element before showing it. This is to test\
            NI_duplicate function.
        nodata: Show header parts only in output.
        attribute: Dump the value of attribute ATTR.
        match: Match attribute: If MATCH is exact, then attribute name is\
            matched exactly. If MATCH is partial, then a match of all the\
            characters in ATTR is enough.
        file: Streamspec is a filename.
        string_: Streamspec is an element string like: '<T font=9 coords="2.3\
            23 2"/>'.
        stdout: Write elements to stdout, instead of stderr.
        hash_: Put the # at the beginning of lines with no data.
        quiet: Quiet stderr messages, and don't echo attribute name with\
            -attribute option.
        find_attr: Only output elements that have an attribute ATTR of value\
            ATTRVAL.
        skip_attr: Do not output elements that have an attribute ATTR of value\
            ATTRVAL.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `NicccOutputs`).
    """
    if find_attr is not None and (len(find_attr) != 2): 
        raise ValueError(f"Length of 'find_attr' must be 2 but was {len(find_attr)}")
    if skip_attr is not None and (len(skip_attr) != 2): 
        raise ValueError(f"Length of 'skip_attr' must be 2 but was {len(skip_attr)}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(NICCC_METADATA)
    cargs = []
    cargs.append("niccc")
    cargs.append(streamspec)
    if duplicate:
        cargs.append("-dup")
    if nodata:
        cargs.append("-nodata")
    if attribute is not None:
        cargs.extend([
            "-attribute",
            attribute
        ])
    if match is not None:
        cargs.extend([
            "-match",
            match
        ])
    if file:
        cargs.append("-f")
    if string_:
        cargs.append("-s")
    if stdout:
        cargs.append("-stdout")
    if hash_:
        cargs.append("-#")
    if quiet:
        cargs.append("-quiet")
    if find_attr is not None:
        cargs.extend([
            "-find_nel_with_attr",
            *find_attr
        ])
    if skip_attr is not None:
        cargs.extend([
            "-skip_nel_with_attr",
            *skip_attr
        ])
    ret = NicccOutputs(
        root=execution.output_file("."),
        stderr_output=execution.output_file("stderr"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "NICCC_METADATA",
    "NicccOutputs",
    "niccc",
]
