Skip to content

Commit

Permalink
beforeText and afterText for summaries
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Aug 20, 2024
1 parent 16bb116 commit b7293bc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ Please contact the pipeline maintainer(s) if you see this warning as a user.

def colors = Utils.logColours(config.monochromeLogs)
String output = ''
output += config.summary.beforeText
def Map paramsMap = paramsSummaryMap(workflow, parameters_schema: schemaFilename)
paramsMap.each { key, value ->
paramsMap[key] = flattenNestedParamsMap(value as Map)
Expand All @@ -517,6 +518,7 @@ Please contact the pipeline maintainer(s) if you see this warning as a user.
}
output += "!! Only displaying parameters that differ from the pipeline defaults !!\n"
output += "-${colors.dim}----------------------------------------------------${colors.reset}-"
output += config.summary.afterText
return output
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package nextflow.validation

import groovy.util.logging.Slf4j
import groovy.transform.PackageScope


/**
* This class allows to model a specific configuration, extracting values from a map and converting
*
* We anotate this class as @PackageScope to restrict the access of their methods only to class in the
* same package
*
* @author : nvnieuwk <[email protected]>
*
*/

@Slf4j
@PackageScope
class SummaryConfig {
final public String beforeText
final public String afterText

SummaryConfig(Map map) {
def config = map ?: Collections.emptyMap()
beforeText = config.beforeText ?: ""
afterText = config.afterText ?: ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ValidationConfig {
final public String parametersSchema
final public Boolean showHiddenParams = false
final public HelpConfig help
final public SummaryConfig summary

final public List<String> ignoreParams

Expand All @@ -37,6 +38,7 @@ class ValidationConfig {
}
parametersSchema = config.parametersSchema ?: "nextflow_schema.json"
help = new HelpConfig(config.help as Map ?: [:], params)
summary = new SummaryConfig(config.summary as Map ?: [:])

if(config.ignoreParams && !(config.ignoreParams instanceof List<String>)) {
throw new SchemaValidationException("Config value 'validation.ignoreParams' should be a list of String values")
Expand Down

0 comments on commit b7293bc

Please sign in to comment.