diff --git a/documentation/bin/createDocu.groovy b/documentation/bin/createDocu.groovy index 44c66f2c7..9388debd1 100644 --- a/documentation/bin/createDocu.groovy +++ b/documentation/bin/createDocu.groovy @@ -381,21 +381,37 @@ steps = [] // // assign parameters -if(args.length >= 1) - stepsDir = new File(args[0]) + +def cli = new CliBuilder( + usage: 'groovy createDocu []', + 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 //