Skip to content

Template functions to replace github.com/Masterminds/sprig.

License

Notifications You must be signed in to change notification settings

chezmoi/templatefuncs

Repository files navigation

templatefuncs

Package templatefuncs provides a rich set of text/template functions.

templatefuncs is a modern alternative to github.com/masterminds/sprig with the following goals:

  • Flexible, practical typing of user-equivalent types (e.g. functions that accept strings also accept fmt.Stringers and []bytes).
  • Correct argument order, compatible with text/template's pipelines where the most variable argument is passed last (e.g. so you can write dict "key" "value" | hasKey "key" instead of hasKey (dict "key" value") "key").
  • Idiomatic Go naming conventions (e.g. toJSON, not toJson).
  • Structure-preserving transformations (e.g. toLower converts a string to a string and also converts a []string to a []string).
  • Linkable documentation for individual template functions (so you can direct users to the documentation for a single function, not just a page of functions).
  • Exported documentation which you can include in your own project (so you can include a full list of template functions that your project supports).
  • Actively maintained.

templatefuncs explicitly is not backwards compatible with github.com/masterminds/sprig.

templatefuncs is currently in the experimental stage and is not suitable for production use.

License

MIT

About

Template functions to replace github.com/Masterminds/sprig.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages