Sublime Forum

Send arguments to build system

#1

I’m working on a little “run with arguments”-plugin but have run into a problem, I’m trying to figure out how to send named arguments to a build system. None of the ones I’ve looked at(C++, Makefile, Erlang, Haskell) have done anything like it. Is it possible or do I need to use the subprocess module?

0 Likes

#2

docs.sublimetext.info/en/latest/ … stems.html

Anything except “target”, “selector” and “variants” in build systems is considered a named argument, afaik.

See github.com/FichteFoll/AAAPackag … lime-build for example.
(And this is the build command.)

0 Likes

#3

That’s the other way around, from build system to plugin.

An example, in my plugin I’ve got something like this:

self.window.run_command("build", {"variant": "Run_args", "args" : text })

and I’ve edited the build system to add a new variant:

{ "name" : "Run_args", "cmd" : "bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}' ${args}"] }

0 Likes

#4

So, you defined a build system. This build system has a variant. And now you want to run that variant from within a plugin?

By using “sublime.log_commands(True)” I found out that the command run is “build” with the parameter {“variant”: “variant name”}.

0 Likes

#5

Yes, but how do I specify what the variable args at the end of the command will contain? I tried that way and it was empty.

0 Likes

#6

I feel like I know how to do what you want but I don’t really understand it exactly.

0 Likes