diff --git a/steps/bulk_rename.cwl b/steps/bulk_rename.cwl new file mode 100644 index 0000000000000000000000000000000000000000..d75af405a73818f56434a1fa7fad010e781d5219 --- /dev/null +++ b/steps/bulk_rename.cwl @@ -0,0 +1,39 @@ +class: CommandLineTool +cwlVersion: v1.0 +$namespaces: + sbg: 'https://www.sevenbridges.com/' +id: bulk_rename +baseCommand: + - bash + - bulk_rename.sh +inputs: + - id: file_list + type: 'File[]' + inputBinding: + position: 0 + - id: file_prefix + type: string + - id: file_suffix + type: string? +outputs: + - id: output + type: 'File[]' + outputBinding: + glob: "tmp/$(inputs.file_prefix)*" +label: bulk_rename +requirements: + - class: InitialWorkDirRequirement + listing: + - entryname: bulk_rename.sh + entry: | + #!/bin/bash + set -e + FILE_LIST=("\${@}") + FILE_PREFIX=$(inputs.file_prefix) + FILE_SUFFIX=$(inputs.file_suffix === null ? '' : inputs.file_suffix) + mkdir tmp + for i in "\${!FILE_LIST[@]}"; do + cp "\${FILE_LIST[\$i]}" "tmp/\${FILE_PREFIX}_\${i}\${FILE_SUFFIX}" + done + writable: false + - class: InlineJavascriptRequirement diff --git a/steps/collectlog.cwl b/steps/collectlog.cwl new file mode 100644 index 0000000000000000000000000000000000000000..57ee22fd2717a3b226ef5973409c83218b2740fc --- /dev/null +++ b/steps/collectlog.cwl @@ -0,0 +1,47 @@ +class: CommandLineTool +cwlVersion: v1.0 +$namespaces: + sbg: 'https://www.sevenbridges.com/' +id: collectlog +baseCommand: + - bash + - collect_logs.sh +inputs: + - id: start_directory + type: Directory? + - id: log_files + type: + - File + - type: array + items: File + inputBinding: + position: 0 + - id: sub_directory_name + type: string +outputs: + - id: log_dir + type: Directory + outputBinding: + glob: | + $(inputs.start_directory === null ? inputs.sub_directory_name: inputs.start_directory.basename) +label: CollectLog +requirements: + - class: InitialWorkDirRequirement + listing: + - entryname: collect_logs.sh + entry: | + #!/bin/bash + set -e + BASE_DIR="$(inputs.start_directory === null ? "" : inputs.start_directory.basename)" + SUB_DIR="$(inputs.sub_directory_name)" + if [ -z "$BASE_DIR" ] + then + OUTPUT_PATH=$SUB_DIR + else + OUTPUT_PATH=$BASE_DIR/$SUB_DIR + fi + echo $OUTPUT_PATH + mkdir -p $OUTPUT_PATH + cp -L $* $OUTPUT_PATH + writable: false + - class: InlineJavascriptRequirement