-
-
Notifications
You must be signed in to change notification settings - Fork 770
Add joinEnv and joinUrl string functions and 2 new system vars #2408
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
base: main
Are you sure you want to change the base?
Conversation
…constants: - PATH_LIST_SEPARATOR -> os.PathListSeparator - FILE_PATH_SEPARATOR -> os.PathSeparator Add joinEnv string function which is sibling to joinPath: - strings.Join(elem, string(os.PathListSeparator)) Add joinUrl string function which is sibling to joinPath: - path.Join(elem...) Add all to docs closes go-task#2406
trulede
left a comment
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.
@solvingj there are quite a few functions already in https://go-task.github.io/slim-sprig/ and perhaps its better to use those existing list functions (join, append, prepend) since that gives a better control over how such lists/strings are generated.
The PathSeparator and PathListSeparator are useful however I would suggest following the existing most-predominate naming convention:
- PathSeparator -> osPathSeparator (note also the absence of "file")
- PathListSeparator -> osPathListSeparator
since the allcaps just looks ODD.
Observation: this could also be done with a .env file, introducing these constants (and others). Perhaps this PR is more effort than value.
|
Up to @pd93 and @andreynering I suppose. |
vmaerten
left a comment
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.
Hello!
Sorry for the delay, we have been busy lately.
PATH_LIST_SEPARATOR / FILE_PATH_SEPARATOR does not work in the templating system.
If you take this Taskfile :
# https://taskfile.dev
version: '3'
tasks:
default:
cmds:
- echo "{{.PATH_LIST_SEPARATOR}}"
- echo "{{.FILE_PATH_SEPARATOR}}"
You will get this result:
For these variables, you need to define them in getSpecialVars inside compiler.go
Ah, of course, moved... |
|
@solvingj the lint is failing. Do you still want to work on it? |
|
Yah I can fix it tomorrow. Just to confirm, are you sure you want to merge it? |
Add two new system variables which map directly to platform specific go constants:
Add joinEnv string function which is sibling to joinPath:
Add joinUrl string function which is sibling to joinPath:
Add all to docs
closes #2406