1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-18 05:18:24 +02:00

Switch to named parameters when invoking docu generation

This commit is contained in:
Marcus Holl 2019-04-12 15:32:30 +02:00
parent bf267b7a92
commit ca33a86ee6

View File

@ -381,21 +381,37 @@ steps = []
//
// assign parameters
if(args.length >= 1)
stepsDir = new File(args[0])
def cli = new CliBuilder(
usage: 'groovy createDocu [<options>]',
header: 'Options:',
footer: 'Copyright: SAP SE')
cli.with {
s longOpt: 'stepsDir', args: 1, argName: 'dir', 'The directory containing the steps. Defaults to \'vars\'.'
d longOpt: 'docuDir', args: 1, argName: 'dir', 'The directory containing the docu stubs. Defaults to \'documentation/docs/steps\'.'
h longOpt: 'help', 'Prints this help.'
}
def options = cli.parse(args)
if(options.h) {
System.err << "Printing help.\n"
cli.usage()
return
}
if(options.s)
stepsDir = new File(Helper.projectRoot, options.s)
stepsDir = stepsDir ?: new File(Helper.projectRoot, "vars")
if(args.length >= 2)
stepsDocuDir = new File(args[1])
if(options.d)
stepsDocuDir = new File(Helper.projectRoot, options.d)
stepsDocuDir = stepsDocuDir ?: new File(Helper.projectRoot, "documentation/docs/steps")
if(args.length >= 3)
steps = (args as List).drop(2) // the first two entries are stepsDir and docuDir
// the other parts are considered as step names
steps.addAll(options.arguments())
// assign parameters
//