rule all:
    input:
        collect("output{x}.{y}.txt", x = range(5), y = range(5)),
        "combined.txt",
        #"fail.txt"


rule create_file:
    output:
        "output{x}.{y}.txt"
    message:
        "Test message"
    shell:
        """
        echo 'Content from file {wildcards.x}.{wildcards.y} and written to be kinda long the quick brown fox jumps over the lazy dog' > {output}
        sleep 1
        """

rule forced_failure:
    output:
        "fail.txt"
    log:
        "logs/fail.log"
    shell:
        "XXechoXX 'this that' > {output} 2> {log}"

rule combine_files:
    input:
        collect("output{x}.{y}.txt", x = range(5), y = range(5))
    output:
        "combined.txt"
    message:
        "Test message"
    conda:
        "envs/conda.yaml"
    shell:
        "cat {input} > {output}"
