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

A task helper to use system commands as input

Notifications You must be signed in to change notification settings

lgestc/vscode-shell-command

 
 

Repository files navigation

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.

About

A task helper to use system commands as input

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%