2中构建并使用参数运行

2中构建并使用参数运行

本文介绍了在Sublime Text 2中构建并使用参数运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在MacOS X上运行,并且正在使用Sublime Text 2进行编码。

I'm running on MacOS X and I'm using Sublime Text 2 to code.

我找到了 +使用选项进行构建,并使用 + + 进行构建和运行。

I've found the + option to build and + + to build and run.

是否可以运行程序(或脚本)并传递参数。示例:

Is it possible to run a program (or script) and pass arguments. Exemple:

myProg arg1 arg2

注意:我正在使用多种语言(C ++,Java,Python),所以我希望有一种方法可以为每个项目而不是所有构建设置参数。

Note: I'm using multiple languages (C++, Java, Python), so I hope there is a way to set the arguments for each project and not for all build.

编辑

我想为程序调用设置参数,有点像在eclipse中您可以在运行程序时设置参数。

I want to set the parameters for a program call, a little bit like in eclipse where you can set the arguments when you run your program.

推荐答案

对于每个项目,您都可以创建一个。 sublime-project 文件,上面带有您的特定 build_system

For each project you can create a .sublime-project file with your specific build_system on it:

{
  "folders":
  [{
    "path": "src"
  }],
  "build_systems":
  [{
    "name": "Run with args",
    "cmd": ["python", "$file", "some", "args"]
  }]
}

这样不会污染全局Build System菜单,也不必担心切换bu切换项目时使用ild系统。当您需要更改参数时,该文件也很容易访问:

This way you don't pollute the global Build System menu and won't have to worry about switching build system as you switch projects. This file is also easy to access when you need to change the arguments:

Cmd-Shift-P > Edit Project

这篇关于在Sublime Text 2中构建并使用参数运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:58