从命令行运行 Visual Studio Code 的任务 [英] Running a task of Visual Studio Code from the command line
问题描述
我在 Visual Studio 代码中有一个简单的项目,在 tasks.json
中有一些已定义的任务.假设任务用 foo
和 bar
标记.
I've a simple project in visual studio code with some defined tasks in tasks.json
. Let's say the task are labeled with foo
and bar
.
在 Visual Studio 代码中,我可以运行 CTRL+B 并选择所需的任务.
Inside of visual studio code I can run CTRL+B and select the wanted task.
但是 - 如何从 Visual Studio Code 之外的命令行运行任务 foo
?
But - How can I run the task foo
from a command line outside of Visual Studio Code?
推荐答案
有一个 python 工具运行 vscode 任务.最后一次提交是在 2018 年,但它仍然可以工作,因为任务似乎最后在 vscode 1.13,于 2017 发布.
There is a python tool that runs the vscode tasks. The last commit was in 2018, but it still might work as it seems that the tasks were last changed in vscode 1.13, released in 2017.
它可以工作,但需要编辑 setup.py:8
以在 Windows 上构建轮子,因为它试图运行 shell 脚本.我的编辑是将行更改为 log = subprocess.check_output('sh bin/changelog')
,因为我安装了 sh
.
edit:
It works but setup.py:8
needs to be edited to build the wheel on windows, as it tries to run a shell script. My edit was to change the line to log = subprocess.check_output('sh bin/changelog')
as I have sh
installed.
这篇关于从命令行运行 Visual Studio Code 的任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!