vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Task Runner: Provide input parameters

Open pcgeek86 opened this issue 10 years ago • 44 comments

  • VSCode Version: 0.10.11
  • OS Version: Mac OS X El Capitan

I would like to provide input parameters when a task is executed. How can I accomplish this?

The documentation mentions "variable substitution," which is useful, but a browser search for "param" yields nothing.

Cheers, Trevor Sullivan Microsoft MVP: PowerShell

pcgeek86 avatar Mar 29 '16 16:03 pcgeek86

This is not supported right now. What would be cool is if you select the task in the quick box if you could provide params there. But this filters right now.

dbaeumer avatar Mar 30 '16 08:03 dbaeumer

Any progress on this?

daleecc avatar Jul 10 '17 09:07 daleecc

No. Nothing has happend here so far.

dbaeumer avatar Jul 11 '17 08:07 dbaeumer

Any chance this will end up in VSCode anytime in the near future? :)

karbowiak avatar Jan 20 '18 14:01 karbowiak

We want to have a task to switch branches across all of our microservices dynamically based on a text string to allow our QA teams to switch to a develop snapshot. Being able to prompt for that string would be of great use to us.

christophla avatar Jan 26 '18 20:01 christophla

Also, it will be great if we could define, in tasks.json, a list of optional variables something like:

{
  "label": "task with options",
  "type": "shell",
  "command": "command-on-${module}",
  "options": [
    "module1",
    "module2",
    "module3"
  ]
}

Thanks!

moshfeu avatar Jan 30 '18 09:01 moshfeu

+1

tdaniely avatar Feb 06 '18 10:02 tdaniely

+1

Being able to manage low-to-medium complexity workflow operations directly from VSCode would be great.

ddurschlag6river avatar Feb 22 '18 21:02 ddurschlag6river

Certainly would be very beneficial to have this ability!

dmitryivashkin avatar Feb 27 '18 14:02 dmitryivashkin

Launch configurations support to embed variables that can be used to ask for input through the UI. Please see https://github.com/Microsoft/vscode/issues/30588.

It is not difficult to support the same for tasks (because they share most of the variable implementation anyway).

weinand avatar Mar 01 '18 17:03 weinand

This is of great interest to me. I work on a CLI project (Angular CLI) and would love to re-use a common debug launch configuration with different arguments.

@weinand I took a look at #30588 and the extension you linked to didn't work for me.

I've also tried to prompt for values using the preLaunchTask option as well with no luck.

Brocco avatar Mar 01 '18 17:03 Brocco

@Brocco

Sorry, I'm not the author of the linked extension and I did not read the description thoroughly.

The documentation is outdated: VS Code has changed the syntax for command variables from an ambiguous '.' to a more readable ':' So instead of ${command.prompt-debug.resolve} please use ${command:prompt-debug.resolve} and it will work fine. I'll file an issue against the extension.

How did you try to prompt for values using the preLaunchTask? Please note that "tasks" do not support prompting variables; only launch configurations do.

weinand avatar Mar 01 '18 21:03 weinand

@Brocco could you get the extension to work?

weinand avatar Mar 06 '18 09:03 weinand

I got it to prompt me, but the entry of the values was confusing and I couldn't get the value I wanted into the launch config.

Admittedly I didn't have a whole lot fo time to play with it and reverted back to my previous workflow for now.

Brocco avatar Mar 12 '18 19:03 Brocco

Sorry, but the extension was meant to be an example showing that you can easily support user input for specific work flows.

Just let me know what you need, and I can sketch something up.

weinand avatar Mar 12 '18 22:03 weinand

It would be good to be able set an input when calling the task. Sometimes we need to run a build or even a test that needs some flags or filters as input depending of what we need.

The task caller can prompt for user input after selecting the task (having in task.json like: "argsPrompt": true) or having some predefined arguments to select before running. Or both :)

ajssousa avatar Mar 13 '18 15:03 ajssousa

+1

mr-joom avatar Apr 12 '18 14:04 mr-joom

+1

dariomangoni avatar May 02 '18 10:05 dariomangoni

+1

thiagomajesk avatar May 04 '18 00:05 thiagomajesk

+1

mblhaunted avatar May 19 '18 15:05 mblhaunted