Sublime Forum

ST3: "--command" option in command line

#1

Hi

I trying to make plugin to open some files. It very simple (not real one, but for idea undertanding):

import sublime, sublime_plugin

class OpenLogsCommand(sublime_plugin.WindowCommand):
	def run(self, move = True):
		self.window.set_layout({'cols': [0.0, 0.5, 1.0],'rows': [0.0, 1.0],'cells': [0, 0, 1, 1], [1, 0, 2, 1]]})
		self.window.focus_group(0)
		self.window.open_file("one.txt")
		self.window.open_file("two.txt")
		self.window.open_file("three.txt")
		self.window.focus_group(1)
		self.window.open_file("three.txt")
		self.window.open_file("five.txt")
		self.window.open_file("six.txt")

This plugin can be run from python command line “window.run_command(“open_logs”)” or from command palette. So, it’s working.
I want to run it from command line, something like:

subl --command "open_logs"

but it not working at all. In the sublime python log I see, that the plugin was loaded, but it not run.
I try to run this way a standard command “show_about_window”:

subl --command "show_about_window"

and it works.
What I doing wrong?

PS: Another thing… As I understand, the command “subl --command “show_about_window”” opened two sublime windows instead of one. I think this is a bug.

0 Likes