Skip to content

Commit

Permalink
small fix to ungrouped params
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Aug 14, 2024
1 parent 4257d5a commit d599785
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ class HelpMessage {
def Map<String,Map> visibleParamsMap = paramsMap.collectEntries { key, Map value -> [key, removeHidden(value)]}
def Map<String,Map> parsedParams = showNested ? visibleParamsMap.collectEntries { key, Map value -> [key, flattenNestedSchemaMap(value)] } : visibleParamsMap
def Integer maxChars = Utils.paramsMaxChars(parsedParams) + 1
if (parsedParams.containsKey(null)) {
def Map ungroupedParams = parsedParams[null]
parsedParams.remove(null)
if (parsedParams.containsKey("Other parameters")) {
def Map ungroupedParams = parsedParams["Other parameters"]
parsedParams.remove("Other parameters")
helpMessage += getHelpListParams(ungroupedParams, maxChars + 2).collect {
it[2..it.length()-1]
}.join("\n") + "\n\n"
Expand Down Expand Up @@ -216,18 +216,18 @@ class HelpMessage {
// This function adds the help parameters to the main parameters map as ungrouped parameters
//
private void addHelpParameters() {
if (!paramsMap.containsKey(null)) {
paramsMap[null] = [:]
if (!paramsMap.containsKey("Other parameters")) {
paramsMap["Other parameters"] = [:]
}
paramsMap[null][config.help.shortParameter] = [
paramsMap["Other parameters"][config.help.shortParameter] = [
"type": ["boolean", "string"],
"description": "Show the help message for all top level parameters. When a parameter is given to `--${config.help.shortParameter}`, the full help message of that parameter will be printed."
]
paramsMap[null][config.help.fullParameter] = [
paramsMap["Other parameters"][config.help.fullParameter] = [
"type": "boolean",
"description": "Show the help message for all non-hidden parameters."
]
paramsMap[null][config.help.showHiddenParameter] = [
paramsMap["Other parameters"][config.help.showHiddenParameter] = [
"type": "boolean",
"description": "Show all hidden parameters in the help message. This needs to be used in combination with `--${config.help.shortParameter}` or `--${config.help.fullParameter}`."
]
Expand Down
6 changes: 3 additions & 3 deletions plugins/nf-schema/src/main/nextflow/validation/Utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ public class Utils {
def paramsMap = [:]
// Grouped params
if (schema_defs) {
for (group in schema_defs) {
def Map group_property = (Map) group.value['properties'] // Gets the property object of the group
def String title = (String) group.value['title']
schema_defs.each { String name, Map group ->
def Map group_property = (Map) group.get('properties') // Gets the property object of the group
def String title = (String) group.get('title') ?: name
def sub_params = [:]
group_property.each { innerkey, value ->
sub_params.put(innerkey, value)
Expand Down

0 comments on commit d599785

Please sign in to comment.