Skip to content

Commit 741114c

Browse files
committed
Pass diag manifests through to rename-split tool
1 parent 1cb9242 commit 741114c

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

flow.cylc

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,30 @@
666666
# Enable nullglob so the wildcard expands to nothing if no files match
667667
shopt -s nullglob
668668
669-
# Find and use the first manifest if it exists
670-
first_manifest=""
671-
for file in $CYLC_WORKFLOW_SHARE_DIR/*diag_manifest.yaml; do
672-
first_manifest=$file
673-
break
669+
# Initialize an empty array to hold our command-line arguments
670+
use_diag_manifest=()
671+
found_manifest="false"
672+
673+
# Loop through all matching files and append them to the array
674+
for file in "$CYLC_WORKFLOW_SHARE_DIR"/cycle/$CYLC_TASK_CYCLE_POINT/*diag_manifest.yaml.*; do
675+
use_diag_manifest+=("--diag-manifest=$file")
676+
found_manifest="true"
674677
done
675-
if [[ -n $first_manifest ]]; then
676-
cp $CYLC_WORKFLOW_SHARE_DIR/*diag_manifest.yaml .
677-
use_diag_manifest="--diag-manifest=$first_manifest"
678-
else
679-
use_diag_manifest=""
678+
679+
# If the array has at least one item, copy the files
680+
if [[ "$found_manifest" == "true" ]]; then
681+
cp "$CYLC_WORKFLOW_SHARE_DIR"/cycle/$CYLC_TASK_CYCLE_POINT/*diag_manifest.yaml.* .
680682
fi
681683
682-
mkdir -p $outputDir
683-
fre -vv pp rename-split --input-dir=$inputDir --output-dir=$outputDir --component=$component $use_subdirs $use_diag_manifest
684+
mkdir -p "$outputDir"
685+
686+
# Expand the array into separate arguments using "${array[@]}"
687+
fre -vv pp rename-split \
688+
--input-dir="$inputDir" \
689+
--output-dir="$outputDir" \
690+
--component="$component" \
691+
$use_subdirs \
692+
"${use_diag_manifest[@]}"
684693
"""
685694

686695
{% if DO_NATIVE %}

0 commit comments

Comments
 (0)