Closed themr0c closed 4 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The addition of sprig made this possible #553
Here's an example where "foo.txt" contains the string "foo"
{{ $fcontent := readFile "/tmp/foo.txt" }}
{{ $prefixname := regexReplaceAll "oo$" $fcontent "" }}
matching:
test:
content: {{ $prefixname }}
matches: "f"
Thanks!
Hello, here is the user story i would like to see in goss:
I would like to check the presence of some file, which is named with a pattern that can be calculated with a regex replacement from a variable that i already have.
For example I want to check the presence of a file /home/{{$prefixname}}/user/example, and $prefixname can be calculated from some variable (that i can get from readFile or from other means).
For the example lets say i can define $hostname:
Now i would like to use this variable to calculate the content of the new variable $prefixname, with a regex replacement.
Some implementation one could think of would be something like following, except the fact that the strings package is not available:
Is there already a way to achieve that? Is it something you would implement?