Sublime Forum

How to get args passed on run_command()

#1

Hey guys,

how can i pass args to run_command and get them on run() function ?

1 Like

#2

Seems like documentation is clear on that. Have you checked it? http://www.sublimetext.com/docs/3/api_reference.html

0 Likes

#3

what do u call “clear”? i’ve seen a lot of functions with single description but no one exemple saying how to do this. sorry. i’m a litle noob to undestand the documentation.

0 Likes

#4

You would pass the arguments in as a dictionary based on what the command requires as arguments, similar to how you might apply them in a key binding. There is an unofficial list of available commands and the arguments they take.

As an example, the exec command can take many arguments, but lets say you want to run a specific program in a specific working directory. That would be the cmd and working_dir arguments; you could do it as follows:

self.window.run_command ("exec", {
    "cmd": "my_executable_name",
     "working_dir": "/tmp/"
    })
4 Likes

#5

awesome!!
thanks @OdatNurd. its hard find people like u! thanks.!!!:grin:

0 Likes