Skip to content
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

Task Runner: Provide input parameters #4758

Closed
pcgeek86 opened this issue Mar 29, 2016 · 44 comments · Fixed by #63910
Closed

Task Runner: Provide input parameters #4758

pcgeek86 opened this issue Mar 29, 2016 · 44 comments · Fixed by #63910
Assignees
Labels
feature-request Request for new features or functionality on-testplan tasks Task system issues
Milestone

Comments

@pcgeek86
Copy link

  • 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

@Tyriar Tyriar added the tasks Task system issues label Mar 29, 2016
@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Mar 30, 2016
@dbaeumer dbaeumer added this to the Backlog milestone Mar 30, 2016
@dbaeumer
Copy link
Member

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.

@daleecc
Copy link

daleecc commented Jul 10, 2017

Any progress on this?

@dbaeumer
Copy link
Member

No. Nothing has happend here so far.

@karbowiak
Copy link

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

@christophla
Copy link

christophla commented Jan 26, 2018

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.

@moshfeu
Copy link
Contributor

moshfeu commented Jan 30, 2018

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!

@tdaniely
Copy link

tdaniely commented Feb 6, 2018

+1

@ddurschlag6river
Copy link

+1

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

@dmitryivashkin
Copy link

Certainly would be very beneficial to have this ability!

@weinand
Copy link
Contributor

weinand commented Mar 1, 2018

Launch configurations support to embed variables that can be used to ask for input through the UI.
Please see #30588.

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

@Brocco
Copy link

Brocco commented Mar 1, 2018

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.

@weinand
Copy link
Contributor

weinand commented Mar 1, 2018

@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
Copy link
Contributor

weinand commented Mar 6, 2018

@Brocco could you get the extension to work?

@Brocco
Copy link

Brocco commented Mar 12, 2018

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.

@weinand
Copy link
Contributor

weinand commented Mar 12, 2018

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.

@ajssousa
Copy link

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 :)

@mr-joom
Copy link

mr-joom commented Apr 12, 2018

+1

@dbaeumer dbaeumer modified the milestones: Backlog, On Deck Apr 13, 2018
@dariomangoni
Copy link

+1

5 similar comments
@thiagomajesk
Copy link

+1

@mblhaunted
Copy link

mblhaunted commented May 19, 2018

+1

@trlsmax
Copy link

trlsmax commented May 23, 2018

+1

@dirondin
Copy link
Contributor

+1

@lochbrunner
Copy link

+1

@v1nu
Copy link

v1nu commented Jun 24, 2018

+1

4 similar comments
@vitalyu
Copy link

vitalyu commented Jun 29, 2018

+1

@xiaocaibird
Copy link

+1

@TakeItAwayMarty
Copy link

+1

@naillizard
Copy link

+1

@probert94
Copy link

probert94 commented Jul 12, 2018

I found a solution on Stackoverflow, which works at least for windows:

{
        "label": "runwithargs",
        "type": "shell",
        "windows": {
            "options": {
                "shell": {
                    "executable": "powershell.exe",
                    "args": [
                        "-NoProfile",
                        "-ExecutionPolicy",
                        "Bypass",
                        "-Command"
                    ]
                }
            },
            "command": "",
            "args": [
                { "value": "$cmdargs = read-host 'Enter command line arguments';", "quoting": "weak"},
                { "value": "$morecmdargs = read-host 'Enter more command line arguments';", "quoting": "weak"},
                { "value": "command-to-execute $cmdargs $morecmdargs", "quoting": "weak"}
            ]
        },      
        "presentation": {
            "panel": "dedicated",
            "focus": true
        }
    }

As you can see, it is also possible to prompt for multiple arguments.
The only drawback I noticed so far is, that it tells the definition is not valid. But you can ignore that, it works anyways.

@philosowaffle
Copy link

👆 the suspense is killing me....

@probert94
Copy link

Sorry for my incomplete comment, I was probably on my phone... 😄

@bracco23
Copy link

+1

@sriramsa
Copy link

This would be a real good feature for some of the debugging scenarios using vscode we are looking at. Specifically to debug inside docker containers.

@probert94
Copy link

@alexr00 Thank you for solving this issue. Is there any documentation on how to use this new feature?

@alexr00
Copy link
Member

alexr00 commented Dec 3, 2018

I'll be writing documentation for it this week to link to in the release notes.

@probert94
Copy link

Thank you for your effort and the fast response :)

@idanpa
Copy link

idanpa commented Dec 8, 2018

I worked with the new feature on the Insiders build and it looks great, this is really helpful for my workflow, thanks.

Forgive me if I'm being greedy but it would be great to have input "type" option that would let me skip the prompt and use only the "default" value, this way I would not being nagged by the prompt in cases I want this value to be constant.

@dbaeumer dbaeumer assigned alexr00 and unassigned dbaeumer Dec 10, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan tasks Task system issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.