Hi,
I’m trying to write a little plugin to let me run my program with arguments taken from a popup text box, but I’ve run into problems.
I’ve added a keybinding
{ "keys": "f8"], "command" : "User.run_with_args" },
to Default(OSX).sublime-keymap and my little plugin located at Packages/User/run_with_args.py) currently looks like this:
[code]import sublime, sublime_plugin
class PromptRunWithArgsCommand(sublime_plugin.TextCommand):
def run(self, edit):
sublime.message_dialog(“testing”)
self.window.show_input_panel("Enter arguments: ", “”, self.on_done, None, None)
def on_done(self, text):
parts = text.split(" ")
self.window.active_view().run_command("run_with_args", {"args" : parts} )
class RunWithArgsCommand(sublime_plugin.TextCommand):
def run(self, args):
#get build system, run target program[/code]
Now I have two questions.
- How do I make the keybinding find my command? If I switch from “run_with_args” to “build” it works fine. And should I split the two commands into two files? I assume that Sublime finds the commands by file name.
- How do I make the current build system run the taget program?