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

Support for additional sprig template functions #102

Open
nothingofuse opened this issue Jun 13, 2024 · 3 comments
Open

Support for additional sprig template functions #102

nothingofuse opened this issue Jun 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@nothingofuse
Copy link

What problem are you facing?

I want to use function-go-templating to do things like:

  • write conditionals based on strings containing substrings
  • split strings to reconstruct pieces of a string into other resource fields
  • find unique items in a list to create resources based only on those unique items
  • trim suffixes or prefixes from strings

How could this Function help solve your problem?

By implementing more of the functions from the masterminds/sprig library the function is using to enable support for more of the library's functions, primarily the functions in
http://masterminds.github.io/sprig/defaults.html
http://masterminds.github.io/sprig/strings.html
http://masterminds.github.io/sprig/lists.html

@nothingofuse nothingofuse added the enhancement New feature or request label Jun 13, 2024
@LCaparelli
Copy link

I would also add that supporting Sprig functions would assist engineers that are already used to Helm, which provides the same Spring functions. Familiarity with Helm seems to be one of the goals of this function, or at least being as familiar to the user as possible, a very nice-to-have feature in that sense.

@jaylevin
Copy link
Contributor

jaylevin commented Jun 24, 2024

This function already supports all the Sprig functions.

From the README:

This function supports all of Go's built-in template functions. The above examples use the index function to access keys like resource-name that contain periods, hyphens and other special characters. Like Helm, this function also supports Sprig template functions as well as additional functions.

@LCaparelli
Copy link

@jaylevin You're right, the function that I was looking for and couldn't find was truncate, which doesn't exist and I really meant to use trunc 😅 .

Thanks, sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants