Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support passing arbitrary key=value pairs #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidalpert
Copy link

What does this do / why do we need it?

this commit addresses the first part of #261 by allowing the passing of arbitrary key=value arguments into the command line and exposing them as part of RenderData for use in the templates

How this PR fixes the problem?

A new --arg CLI parameter has been added. This supports multiple key=value args like so

git-chglog --arg key1=val1 --arg key2=val2 1.0.0

Those --arg values are collected into a slice, then each item split by = into a key and a value, then added into a map and exposed on the RenderData struct so that they can be referenced in templates like this:

{{ index .Args "key1" }} - {{ index .Args "key2" }}

which renders

val1 - val2

Check lists

  • Test passed
  • Coding style (indentation, etc)

Additional Comments (if any)

None.

Which issue(s) does this PR fix?

fixes #261

this commit addresses git-chglog#261 by allowing the passing of
arbitrary key=value arguments into the command line
and exposing them as part of RenderData for use
in the templates

resolves: git-chglog#261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: pass additional data/vars into the templates
1 participant