Skip to content

Commit

Permalink
fix issues and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Aug 13, 2024
1 parent 78e79b6 commit 273a72b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class HelpMessage {
" --" + it[4..it.length()-1]
}
.join("\n")
helpMessage += " " + colors.dim + "options".padRight(optionMaxChars) + ": " + colors.reset + "\n" + subParamsHelpString + "\n"
helpMessage += " " + colors.dim + "options".padRight(optionMaxChars) + ": " + colors.reset + "\n" + subParamsHelpString + "\n\n"
continue
}
def String value = option.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ Please contact the pipeline maintainer(s) if you see this warning as a user.
}

def Map params = session.params
def Map validationConfig = (Map)session.config.navigate("validation")
validationConfig.parametersSchema = options.containsKey('parameters_schema') ? options.parameters_schema as String : config.parametersSchema
validationConfig.help = (Map)validationConfig.help + [command: command, beforeText: "", afterText: ""]
def Map validationConfig = (Map)session.config.navigate("validation") ?: [:]
validationConfig.parametersSchema = options.containsKey('parameters_schema') ? options.parameters_schema as String : validationConfig.parametersSchema
validationConfig.help = (Map)(validationConfig.help ?: [:]) + [command: command, beforeText: "", afterText: ""]
def ValidationConfig copyConfig = new ValidationConfig(validationConfig, params)
def HelpMessage helpMessage = new HelpMessage(copyConfig, session)
def String help = helpMessage.getBeforeText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ParamsHelpTest extends Dsl2Spec{
"""

when:
def result = new MockScriptRunner([:]).setScript(SCRIPT).execute()
def result = new MockScriptRunner([validation:[monochromeLogs:true]]).setScript(SCRIPT).execute()
def stdout = capture
.toString()
.readLines()
Expand Down Expand Up @@ -177,7 +177,7 @@ class ParamsHelpTest extends Dsl2Spec{

then:
def error = thrown(Exception)
error.message == "Specified param 'no_exist' does not exist in JSON schema."
error.message == "Unable to create help message: Specified param 'no_exist' does not exist in JSON schema."
!stdout
}

Expand All @@ -195,14 +195,14 @@ class ParamsHelpTest extends Dsl2Spec{
"""

when:
def result = new MockScriptRunner([:]).setScript(SCRIPT).execute()
def result = new MockScriptRunner([validation:[monochromeLogs:true]]).setScript(SCRIPT).execute()
def stdout = capture
.toString()
.readLines()
.findResults {it.startsWith('--this.is') ||
it.contains('description:') ||
it.contains('options :') ||
it.contains('.so')
it.contains('this.is.so.deep')
? it : null }

then:
Expand Down

0 comments on commit 273a72b

Please sign in to comment.