-
Notifications
You must be signed in to change notification settings - Fork 87
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
Can I get the original value if variable empty #56
Comments
This would be so helpful. |
need this too! |
Did anyone implemented this feature over time? I went looking into the forks, and the closes thing I found is https://github.com/dnitsch/envsubst by @dnitsch https://github.com/dnitsch/envsubst/blob/86a677a7c7e531f5ce7c9efa9e5c3a888f463446/envsubst.go#L33 The only drawback with this fork is that it doesn't seem to handle the default variables, that is when your template contain a variable that is set to a default when not set in the env: "if default is set, noreplace should not be used": {
input: `Some: $REPLACE
NoReplaceNotToBeUsed: ${someVarWithDefault:=myDefault}`,
env: []string{"REPLACE=bar"},
restrictions: &Restrictions{NoUnset: false, NoEmpty: false, NoDigit: true, NoReplace: true},
expected: `Some: bar
NoReplaceNotToBeUsed: myDefault`,
}, The above test fails in this fork... |
Hi, I need to know if there is a variable in my text that is empty after expanding it. I need those variables not to expand and use the original string.
Is there a way of getting
hello $NAME
as the output?The text was updated successfully, but these errors were encountered: