diff --git a/README.md b/README.md index 3fe8212..b030d0a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # InputArgs -A sublime text plugin to send custom input arguments when building using 'ctrl + b'. View a program output with custom arguments from within sublime text. - +A sublime text plugin to send custom input arguments when building using 'ctrl + b'. View a program output with custom arguments from within sublime text (see http://stackoverflow.com/questions/16490889/build-and-run-with-arguments-in-sublime-text-2 for discussion and alternatives). ##Installing @@ -34,4 +33,17 @@ Standard sublime text build system commands. Use "ctrl+b" to run the build system and an input dialog will ask for arguments. -New Build Systems can be added through "Tools>Build System>New Build System". \ No newline at end of file +New build systems can be added through "Tools>Build System>New Build System". + +If you'd rather not override your build system and instead would prefer to customize it, you can use the `target` option and change the name of the plugin command from `ExecCommand`; e.g., `InputArgsCommand` would match the target option `input_args` as shown in the below example: + +### Example build system +``` +{ + "shell_cmd" : ["make $file_base_name && ./$file_base_name"], + "selector" : "source.c", + "shell": true, + "target": "input_args", + "working_dir" : "$file_path", +} +``` \ No newline at end of file diff --git a/exec.py b/exec.py index 209c2d6..e8e1ded 100644 --- a/exec.py +++ b/exec.py @@ -137,7 +137,8 @@ def run(self, cmd = None, shell_cmd = None, file_regex = "", line_regex = "", wo word_wrap = True, syntax = "Packages/Text/Plain text.tmLanguage", # Catches "path" and "shell" **kwargs): - self.sl = kwargs + + shell_cmd = ''.join(shell_cmd) # clear the text_queue self.text_queue_lock.acquire() self.truth = False @@ -241,7 +242,7 @@ def fun(self, cmd, shell_cmd, merged_env, ss): try: # Forward kwargs to AsyncProcess - self.proc = AsyncProcess(cmd, shell_cmd, merged_env, self, self.sl) + self.proc = AsyncProcess(cmd, shell_cmd, merged_env, self) self.text_queue_lock.acquire() try: