lib/bolt/pal/yaml_plan/transpiler.rb in bolt-2.23.0 vs lib/bolt/pal/yaml_plan/transpiler.rb in bolt-2.24.0
- old
+ new
@@ -19,13 +19,21 @@
@modulename = Bolt::Util.module_name(@plan_path)
@filename = @plan_path.split(File::SEPARATOR)[-1]
validate_path
plan_object = parse_plan
+ param_descriptions = plan_object.parameters.map do |param|
+ str = String.new("# @param #{param.name}")
+ str << " #{param.description}" if param.description
+ str
+ end.join("\n")
- plan_string = String.new("# WARNING: This is an autogenerated plan. " \
- "It may not behave as expected.\n" \
- "plan #{plan_object.name}(")
+ plan_string = String.new('')
+ plan_string << "# #{plan_object.description}\n" if plan_object.description
+ plan_string << "# WARNING: This is an autogenerated plan. It may not behave as expected.\n"
+ plan_string << "#{param_descriptions}\n" unless param_descriptions.empty?
+
+ plan_string << "plan #{plan_object.name}("
# Parameters are Bolt::PAL::YamlPlan::Parameter
plan_object.parameters&.each_with_index do |param, i|
plan_string << param.transpile
# If it's the last parameter add a newline and no comma