Last active
March 15, 2021 12:50
-
-
Save OdatNurd/b0fc0d95d20786e1c97d58785ed1157e to your computer and use it in GitHub Desktop.
Sample of a subclass of ExecCommand that allows arbitrary build options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"target": "my_exec", | |
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"", | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${file_path}", | |
"selector": "source.c, source.c++", | |
"exe_path": "something.exe", | |
"variants": | |
[ | |
{ | |
"name": "Run", | |
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime | |
import sublime_plugin | |
from Default.exec import ExecCommand | |
class MyExecCommand(ExecCommand): | |
def run(self, **kwargs): | |
# All arguments that the exec command doesn't handle by default need | |
# to be popped before continuing, since they're passed to the underlying | |
# AsyncProcess, which will throw an error if it gets an unrecognized | |
# argument. | |
self.exe_path = kwargs.pop("exe_path", "") | |
super().run(**kwargs) | |
def finish(self, proc): | |
super().finish(proc) | |
print("The build is finished and exe_path is %s" % self.exe_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment