How share utils helpers between tasks? #3417
Replies: 3 comments
-
I don't know or have many ideas, perhaps others can brainstorm or come up with recipes |
Beta Was this translation helpful? Give feedback.
-
One option is to convert those functions into individual executable shell scripts in a new directory, then add that directory to the path with https://mise.jdx.dev/environments.html#env-path any shared env vars can be directly set in the config. E.g.
#!/usr/bin/env bash
export PROJECT = "foo"
function log {
echo "[$PROJECT] [$(date +%FT%T)] $1"
}
function compose {
docker-compose --project $PROJECT --volume $(pwd):/srv ${@}
} To
[env]
PROJECT = "foo"
PROJECT_ROOT = "{{ config_root }}"
_.path = "./utils"
#!/usr/bin/env bash
echo "[$PROJECT] [$(date +%FT%T)] $1"
#!/usr/bin/env bash
docker-compose --project $PROJECT --volume ${PROJECT_ROOT}:/srv ${@} |
Beta Was this translation helpful? Give feedback.
-
I will say that explicitly calling |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm trying to figure out how I could automatically load a set of files and/or a file that contains helper functions that will be automatically loaded into all tasks, without having to explicitly call
source myutils.sh
.Please tell me, does mise allow you to do such a trick?
Beta Was this translation helpful? Give feedback.
All reactions