Build System Input
Extend default Sublime Text 3 build systems with input arguments.
Details
Installs
- Total 2K
- Win 2K
- Mac 351
- Linux 328
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
Mac | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
BuildSystemInput
Extend default Sublime Text 3 build systems with input arguments.
Choose the "build_system_input"
target in any build system to prompt for inputs, which are substituted for any occurence of the corresponding variable in "cmd"
or "shell_cmd"
. The input variables and their default values are provided in the new "input"
dictionary. For example,
"input": {
"input1": "a",
"input2": "b"
}
will first prompt for %input1%
with default value "a"
and then for %input2%
with default value "b"
. Two simple use cases of this concept are shown below for a single input variable. However, you can use as many input variables as you like.
Pass arguments to a Python script:
{
"target": "build_system_input",
"selector" : "source.python",
"shell_cmd": "xterm -e 'python $file_name %args%; echo && echo Press ENTER to continue && read line && exit'",
"windows": {
"shell_cmd": "start cmd /k \"python $file_name %args% & pause && exit\""
},
"shell": true,
"file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)",
"working_dir": "$file_path",
"input": {
"args": "some arguments"
}
}
Pass compiler flags to clang:
{
"target": "build_system_input",
"selector" : "source.c, source.cpp, source.c++",
"cmd": ["clang++", "-std=c++11", "-Wno-c++98-compat-pedantic", "%flags%", "-Wall", "-o", "$file_base_name", "$file_name"],
"windows": {
"cmd": ["clang-cl", "-std=c++11", "-Wno-c++98-compat-pedantic", "%flags", "/Wall", "/o", "$file_base_name", "$file_name"]
},
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "$file_path",
"variants": [
{
"name": "Run Terminal",
"shell_cmd": "clang++ -std=c++11 -Wno-c++98-compat-pedantic %flags% -Wall \"$file\" -o \"$file_path/$file_base_name\" && xterm -e '$file_path/$file_base_name; echo && echo Press ENTER to continue && read line && exit'",
"windows": {
"shell_cmd": "clang-cl -std=c++11 -Wno-c++98-compat-pedantic %flags% /Wall \"$file\" /o \"$file_path/$file_base_name\" && start cmd /k \"$file_base_name & pause && exit\""
},
"shell": true
}
],
"input": {
"flags": "-Wno-newline-eof"
}
}
NOTE: In contrast to the UNIX-style Sublime Text 3 build system variables, i. e. $var
, this package uses DOS-style variables, i. e. %var%
. This is, because Sublime Text will try to substitute environment variables in "cmd"
and "shell_cmd"
, which results in the erasion of all unknown variables.
Installation
Clone this repository to your Sublime Text 3 Packages folder. You can find it by using the menu: Preferences > Browse Packages…
No configuration is necessary apart from using the "build_system_input"
as target for your custom build system.