带有选项的Sublime文本构建系统 [英] Sublime Text Build System With Options

查看:116
本文介绍了带有选项的Sublime文本构建系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目的各种Shell构建脚本,并且想要创建一个集中化的构建系统,并带有允许运行哪个Shell脚本的选项.例如,用户按下Cmd + B,然后为用户提供以下选项:

I have various shell build scripts for a project and want to create one centralized build system with options that will allow which shell script to run. For example, a user presses Cmd + B then the user is given the option:

1)shellscript1.sh
2)shellscript2.sh
3)shellscript3.sh

1) shellscript1.sh
2) shellscript2.sh
3) shellscript3.sh

用户按下3,Sublime Text运行'sh shellscript3.sh'.

The user presses 3 and Sublime Text runs 'sh shellscript3.sh'.

我一直在阅读 http://sublimetext.info/docs/en/reference /build_systems.html ,但不确定如何将此选项集成到Sublime Text构建系统的JSON代码中.

I've been reading http://sublimetext.info/docs/en/reference/build_systems.html, but am unsure how to integrate this option in the JSON code for the Sublime Text build system.

您如何在Sublime Text 2的构建系统中完成此任务?

How do you accomplish this in a build system in Sublime Text 2?

谢谢!

推荐答案

我最终制作了自己的插件,并在run()中放置了以下内容:

I ended up making my own plugin and placed the following in run():

self.view.window().run_command('exec', {'cmd': ['sh', 'script.sh'], 'quiet': False})        

我基于此Git支持插件的代码进行了构建: https://github.com/notanumber/gitst2

I based it off of the code of this Git Support plugin: https://github.com/notanumber/gitst2

这篇关于带有选项的Sublime文本构建系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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