vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Feature request: Override command at task level

Open rajkumar42 opened this issue 10 years ago • 1 comments

  • VSCode Version: 1.1.1
  • OS Version: any

Currently tasks.json schema requires a top level command which will be invoked along with task arguments.

Say for example a simple dotnet app, it looks like this.

{
    "version": "0.1.0",
    "command": "dotnet",
    "isShellCommand": true,
    "args": [],
    "tasks": [
        {
            "taskName": "build",
            "args": [],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        }
    ]
}

However if i have a build script which builds and deploys the binaries on a docker container. I could solve the issue like this

{
    "version": "0.1.0",
    "windows" : {
        "command": "cmd",
        "args" : ["/c"]
    },
    "suppressTaskName": true,    
    "tasks": [
        {
            "taskName": "build",
            "args": ["dotnet build"],
            "isBuildCommand": true            
        },
        {
            "taskName": "buildDocker",
            "args": ["dotnetdocker build"],
            "isBuildCommand": true            
        }
    ]
}

But this requires spinning up an extra shell. It would be better if the task allows fully overriding the command. That would simplify the tasks.json to something like

{
    "version": "0.1.0",
    "command": "dotnet",
    "isShellCommand": true,
    "args": [],
    "tasks": [
        {
            "taskName": "build",
            "args": [],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        },
        {
            "overrideCommand": true,
            "taskName": "buildDocker",
            "command":"dotnetdocker"
            "args": ["build"],
            "isBuildCommand": true,
            "problemMatcher": "$msCompile"
        }
    ]
}

rajkumar42 avatar May 18 '16 19:05 rajkumar42

This got implemented for task 0.1.0 and 2.0.0. Each task can define its own command.

dbaeumer avatar Nov 10 '17 14:11 dbaeumer