mise icon indicating copy to clipboard operation
mise copied to clipboard

Pass arguments for `mise run` interactive menu

Open kapitoshka438 opened this issue 1 year ago • 5 comments

I have a bash script which takes an argument and a mise action in .mise.toml:

[tasks."genflux"]
description = 'Generate Flux module'
run = "./Scripts/flux.sh -n $1"

I can run the action this way: mise run genflux MyModule But is there a way to use interactive menu (using just mise run) to select the action and then pass the argument?

kapitoshka438 avatar Mar 18 '24 19:03 kapitoshka438

I don't think I would want to do this. It would require an awkward flag like mise run --args or something that feels more confusing to try to explain than is worth the value in having this

you could probably figure out a way to use fzf to make your own shell function for this task

jdx avatar Mar 18 '24 22:03 jdx

It might look like this, without passing awkward flags to mise run itself:

[tasks."genflux"]
description = 'Generate Flux module'
args = ["arg1", "arg2"]
run = "./Scripts/flux.sh --arg $1 --arg2 $2"

kapitoshka438 avatar Mar 18 '24 22:03 kapitoshka438

I think what you're asking for is default arguments, which is planned but something that might take me a while to get around to

jdx avatar Mar 18 '24 22:03 jdx

I apologize for being confusing. What I was asking is parameters names, not their default values. After selecting an action ditch a defined array of parameters names, mise interactive menu would ask user to input missing values (in case of interactive mode all arguments are missing lol). Like, for example, it's implemented in Fastlane.

kapitoshka438 avatar Mar 18 '24 23:03 kapitoshka438

ah this also is planned, it's part of what I'm working on with usage. That said, I have no clue when I'll be able to get to it

jdx avatar Mar 19 '24 00:03 jdx