gruntwork-io / boilerplate

A tool for generating files and folders ("boilerplate") from a set of templates
https://www.gruntwork.io
Mozilla Public License 2.0
157 stars 12 forks source link

Fix slice parsing #147

Closed brikis98 closed 6 months ago

brikis98 commented 6 months ago

Description

As per https://github.com/urfave/cli/issues/1134, urfave/cli allows you to pass in "slices" (CLI args that can have multiple values) via either:

  1. Passing the arg multiple times: e.g., --var first --var second --var third.
  2. Passing multiple values to the arg with a separator (default: comma): e.g., --var first,second,third.

This second behavior is problematic for boilerplate, as we allow you to pass JSON and YAML into --var values, and JSON and YAML can contain commas. So these JSON and YAML values were being broken up in the middle, which made them invalid... And the error message we got was super unhelpful:

yaml: line 1: did not find expected ',' or '}'

This PR disables the second type of slice parsing. I also added a regression test that would fail with the unhelpful error above before the PR and passes now after the PR.

TODOs

Read the Gruntwork contribution guidelines.

Release Notes (draft)

Added / Removed / Updated [X].

Migration Guide

brikis98 commented 6 months ago

Thanks for the review! Merging now.