You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, the customs template function will return an error if a requested key was missing for any of the changelog entries.
This makes it difficult to add a new custom key with existing unreleased changes.
For example, if you do:
changie init
changie new # answer prompts
changie new # answer prompts$EDITOR .changie.yaml
# Add a new custom config, and use it in the template with `{{customs .Changes "Foo"}}`.
changie batch
# Error: missing custom key: 'Foo'
Describe the solution you'd like
The customs function should return an empty string for keys that are absent.
This will match the behavior of directly accessing the custom field via .Change.Custom.Foo.
Alternatively, if this this change is considered breaking, a new function customValues would do.
Describe alternatives you've considered
Iterating over .Changes and accessing the custom fields directly.
This isn't as nice because you can't post-process and dedupe, e.g. customs .Changes "Foo" | compact | uniq.
Additional context
If we're in agreement about the change, I'm happy to make a PR for it.
The text was updated successfully, but these errors were encountered:
Hmm, I think my idea for this at the time was that, it could prevent typos if you see an error over an empty string. But I agree it is a little lame thinking about it again. I agree with this change.
abhinav
added a commit
to abhinav/changie
that referenced
this issue
Sep 16, 2023
If 'customs' returns an error for missing keys on changes,
it's difficult to add a new custom key with unreleased changes pending
and a template that uses 'customs'.
Change 'customs' to yield an empty string for a missing custom key.
This matches the behavior of accessing the missing key directly
via `$change.Custom.Foo`.
Resolvesminiscruff#536
If 'customs' returns an error for missing keys on changes,
it's difficult to add a new custom key with unreleased changes pending
and a template that uses 'customs'.
Change 'customs' to yield an empty string for a missing custom key.
This matches the behavior of accessing the missing key directly
via `$change.Custom.Foo`.
Resolves#536
* Prepare release v1.13.1
Co-authored-by: Ronnie <miniscruff@hey.com>
Is your feature request related to a problem? Please describe.
Currently, the
customs
template function will return an error if a requested key was missing for any of the changelog entries.This makes it difficult to add a new custom key with existing unreleased changes.
For example, if you do:
Describe the solution you'd like
The
customs
function should return an empty string for keys that are absent.This will match the behavior of directly accessing the custom field via
.Change.Custom.Foo
.Alternatively, if this this change is considered breaking, a new function
customValues
would do.Describe alternatives you've considered
Iterating over
.Changes
and accessing the custom fields directly.This isn't as nice because you can't post-process and dedupe, e.g.
customs .Changes "Foo" | compact | uniq
.Additional context
If we're in agreement about the change, I'm happy to make a PR for it.
The text was updated successfully, but these errors were encountered: