-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
New function: file.Walk
#281
New function: file.Walk
#281
Conversation
Hi @christopher-avila, thank you for this contribution! Can you please describe what you're aiming for with $ gomplate -i '{{ range file.ReadDir "." }}{{ if not (file.IsDir .) }}{{ . }} IS A FILE{{"\n"}}{{ end }}{{ end -}}'
Gopkg.toml IS A FILE
LICENSE IS A FILE
CHANGELOG.md IS A FILE
... As for Ideally I like to also have tests and documentation added for any new functions. If you're not comfortable with these I can add them in after. Thanks! |
Hi @hairyhenderson ! Thanks for your answer!
For example:
On the other hand, we have
In addition,
On the other hand, we have
For the case of And for the tests, I can do them, or I can leave them for you, as you prefer :) Really thanks for your time. |
Any update on this? |
funcs/strings.go
Outdated
@@ -43,6 +43,7 @@ func AddStringFuncs(f map[string]interface{}) { | |||
f["split"] = strings.Split | |||
f["splitN"] = strings.SplitN | |||
f["trim"] = strings.Trim | |||
f["trimPrefix"] = strings.TrimPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to add new non-namespaced functions nowadays. Please remove this line.
@christopher-avila @robermorales sorry for the delay. Thanks for adding the TrimPrefix tests. That looks good to me. I thought I'd mentioned it before, but I clearly didn't - I'd much rather merge the 2 new functions as separate PRs (to keep history clean). Can you propose the As for $ gomplate -i '{{ range file.Walk "." }}{{ if not (file.IsDir .) }}{{ . }} IS A FILE{{"\n"}}{{ end }}{{ end -}}'
README.md IS A FILE
aws/ec2info.go IS A FILE
aws/ec2meta.go IS A FILE
aws/testutils.go IS A FILE
base64/base64.go IS A FILE
... What do you think? |
files.FindFiles
and trimPrefix
files.Walk
I'm modifying the Thanks for your time! |
From: https://ci.appveyor.com/project/hairyhenderson/gomplate/build/637
Any idea of this? =/ |
Thanks @christopher-avila! I'm thinking the issue has to do with Windows path separators. If you instead use |
I think it is solved. Take a look! Thanks for your time! :) |
Thanks again for the contribution, @christopher-avila! |
files.Walk
file.Walk
Thanks to you for your time! |
file.Walk
file.Walk
No description provided.