Files
davelopez b7e73a2bf5 Resolve store_root in $input.path and share it with to_cwl
$input.path, the YAML runtime and to_cwl now all take a dataset's path
from dataset_path(), which resolves the wrapper folder an older Zarr
dataset recorded in store_root. Document that the store_root pattern
keeps working, and run the directory tools under embedded Pulsar, where
$input.path alone must get the folder staged.
2026-10-19 15:09:36 +02:00

48 lines
1.9 KiB
XML

<tool id="dataset_path" name="dataset_path" version="0.1.0" profile="26.2">
<!-- $input.path is the file, or the folder holding a directory dataset's content. -->
<command><![CDATA[
if [ -d '$input.path' ]; then ls -A '$input.path'; else cat '$input.path'; fi > '$listing'
#if $input.is_of_type("directory")
&& mkdir -p '$output_directory.path'
&& cp -r '$input.path'/. '$output_directory.path'
#end if
]]></command>
<inputs>
<param name="input" type="data" format="txt,directory"/>
</inputs>
<outputs>
<data name="listing" format="txt"/>
<data name="output_directory" format="directory">
<!-- Only directory datatypes have content_path; the command writes this output for those. -->
<filter>hasattr(input.datatype, "content_path")</filter>
</data>
</outputs>
<tests>
<test expect_num_outputs="1">
<param name="input" value="simple_line.txt" ftype="txt"/>
<output name="listing" file="simple_line.txt"/>
</test>
<test expect_num_outputs="2">
<param name="input" value="simple_directory" class="Directory" ftype="directory"/>
<output name="listing">
<assert_contents>
<has_line line="a.txt"/>
<has_line line="sub"/>
</assert_contents>
</output>
<output name="output_directory" ftype="directory">
<extra_files type="file" name="a.txt">
<assert_contents>
<has_text text="hello"/>
</assert_contents>
</extra_files>
<extra_files type="file" name="sub/b.txt">
<assert_contents>
<has_text text="world"/>
</assert_contents>
</extra_files>
</output>
</test>
</tests>
</tool>