Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Latest commit

 

History

History
50 lines (42 loc) · 1.59 KB

README.md

File metadata and controls

50 lines (42 loc) · 1.59 KB

Tasks: Shell Input

This extension aims to extend the possibilities of input in task execution. Currently, VSCode supports 3 types of inputs for your tasks:

  • promptString
  • pickString
  • Command

None of them allows to get an input from a system command for example. This extension executes a shell command in your OS and each line of the output will be used as a possible input for your task.

Usage example:

Extension Demo

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Echo Project File",
      "type": "shell",
      "command": "echo ${input:inputTest}",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "inputTest",
      "type": "command",
      "command": "shellCommand.execute",
      "args": {
          "command": "cat ${file}",
          "cwd": "${workspaceFolder}"
          "env": {
              "WORKSPACE": "${workspaceFolder[0]}",
              "FILE": ${file},
              "PROJECT": ${workspaceFolderBasename}

          }
      }
    }
  ]
}

Arguments for the extension:

  • command: the system command to be executed (must be in PATH)
  • cwd: the directory from within it will be executed
  • env: key-value pairs to use as environment variables (it won't append the variables to the current existing ones. It will replace instead)

In the moment it supports only file, workspaceFolder and workspaceFolderBasename vscode variables.