建立并与崇高的文本2 ARGS运行 [英] Build and run with args in sublime text 2

查看:128
本文介绍了建立并与崇高的文本2 ARGS运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待通过网站,并没有发现任何有用的......希望你能帮助!

I've look through the web and didn't found anything helpful... hope you can help!

我在MacOS X上运行,我使用的文本崇高2〜code。

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

我已经找到了CMD + B选项来构建和CMD + SHIFT + B来构建和运行。是否有可能运行一个程序(或脚本),并传递参数。例:MYPROG ARG1 ARG2 ...等

I've found the cmd + B option to build and cmd + shift + B to build and run. Is it possible to run a program (or script) and pass arguments. Exemple: myProg arg1 arg2...etc

请注意:我使用多国语言(C ++,Java和Python的...等),所以我希望有一种方法来设置每个项目,而不是对所有的建设ARGS

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

编辑:

我想设置的参数为程序调用,有点像在日食的地方,当你运行你的程序,你可以设置的参数。

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项目与您的特定文件中的每个项目 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"]
  }]
}

这样,您就不会污染全局构建系统菜单,不会担心切换构建系统为您切换项目。该文件也很容易访问时,您需要更改的参数:

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

这篇关于建立并与崇高的文本2 ARGS运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆