Replies: 9 comments 14 replies
-
|
I would just use an env var |
Beta Was this translation helpful? Give feedback.
-
|
yes that is possible, but not so convenient and does not support autocomplete for the argument |
Beta Was this translation helpful? Give feedback.
-
|
Using env variables also causes the issue that you have to run mise for every env option. mise run build app1 :: build app2I've also had a look at the code and it indeed needs quite some restructuring since you need to template the dependencies and add the arg to the 'graph' calculation and the task names have to be updated, otherwise you will see where the only difference is the color of build to mark what is being build. |
Beta Was this translation helpful? Give feedback.
-
|
Can we convert this discussion into an issue, or create an issue from it? Since it's not a straightforward Q&A and rather, more of a feature request, I think it would make sense. Plus I would love to see this feature myself 🙂 |
Beta Was this translation helpful? Give feedback.
-
|
It sounds like process-compose could help you out? I tried creating a simple example for your use case, although I realise it still doesnt offer what you are seeking; to be able to provide arbitrary app directory: # process-compose.yaml
processes:
frontend:
working_dir: frontend
command: pnpm run dev
backend:
working_dir: backend
command: pnpm run dev |
Beta Was this translation helpful? Give feedback.
-
|
What's the correct way to do this? I've seen the advice "just use env variables" but I can't figure it out: [tasks.build]
run = 'echo building image with tag {{arg(name="tag")}}'
[tasks.push]
depends = ["build ???"] # Can't use {{ env.* }} here
run = 'echo pushing image with tag {{arg(name="tag")}}' |
Beta Was this translation helpful? Give feedback.
-
|
I have the following use case: multiplatform C++ build with multiple build prefixes: build/linux and build/windows. So, something like this: [tasks.configure]
usage = '''
arg "<platform>" help="Target platform" default="{{ os() }}"
'''
run = '''
meson setup build/{{usage.platform}}
'''
[tasks.build]
usage = '''
arg "<platform>" help="Target platform" default="{{ os() }}"
'''
depends = [
{ task = "configure", args = ["{{usage.platform}}"] },
]
run = '''
meson compile -C build/{{usage.platform}}
'''So when i'm writing And then you can imagine if you have prefix variants with build config: Release, Debug, etc... you want to have more arguments that configures behavior for tasks And argument
IMHO then why do you need [env]
BUILD_PLATFORM = "{{env.BUILD_PLATFORM | default(value=os())}}"
BUILD_CONFIG = "{{env.BUILD_CONFIG | default(value='release'}}"
[tasks.configure]
run = '''
meson setup build/{{env.BUILD_PLATFORM}} --buildtype {{env.BUILD_CONFIG}} # Oops - bad platform, bad config, no type checking
'''
[tasks.build]
depends = [
{ task = "configure" },
]
run = '''
meson compile -C build/{{env.BUILD_PLATFORM}} # Oops, i forgor to unset BUILD_PLATFORM, so F me
''' |
Beta Was this translation helpful? Give feedback.
-
|
I think this is a fundamental problem with mise tasks and a big reason I can't use it as much as I want to. I want to use it for parallelizing simple commands under the umbrella of a parent task - all of the commands use the same argument(s). For example, I have a |
Beta Was this translation helpful? Give feedback.
-
|
I've opened a PR that implements this feature: #8893 You can now pass arguments to task dependencies using [tasks.start-backend]
usage = 'arg "<app>"'
run = 'cd {{usage.app}}/backend && pnpm run dev'
[tasks.start-frontend]
usage = 'arg "<app>"'
run = 'cd {{usage.app}}/frontend && pnpm run dev'
[tasks.start]
usage = 'arg "<app>"'
depends = [
{ task = "start-backend", args = ["{{usage.app}}"] },
{ task = "start-frontend", args = ["{{usage.app}}"] },
]Then This comment was generated by Claude Code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We are currently trying to integrate mise task in a monorepo where we want to run and build the different applications that all have a frontend and a backend. we want to utilize task dependencies for this but don't find a way to pass arguments to the task dependencies.
Executing it with
mise run start my-app.The "app" should be configurable by the
startso that thestarttask could have anarg()that could be passed to its dependencies. This would be similar to how Taskfile supports passing variables to dependencies https://taskfile.dev/usage/#calling-another-taskBeta Was this translation helpful? Give feedback.
All reactions