-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.py
More file actions
100 lines (74 loc) · 3.24 KB
/
commands.py
File metadata and controls
100 lines (74 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import sublime
import sublime_plugin
import subprocess
from SideBarEnhancements.SideBarAPI import SideBarItem, SideBarSelection, SideBarProject
class WpmToggleCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.name())
plugin_names = " ".join(items)
command = 'wp plugin toggle {0} --path={1}'.format(plugin_names, wp_root_path)
result = subprocess.getoutput(command)
sublime.active_window().status_message(result)
print(result)
class WpmUpdatePluginCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.name())
plugin_names = " ".join(items)
command = 'wp plugin update {0} --path={1}'.format(plugin_names, wp_root_path)
result = subprocess.getoutput(command)
sublime.active_window().status_message(result)
print(result)
class WpmActivateThemeCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
items = []
for item in SideBarSelection(paths).getSelectedItems():
items.append(item.name())
plugin_names = " ".join(items)
command = 'wp theme activate {0} --path={1}'.format(plugin_names, wp_root_path)
result = subprocess.getoutput(command)
sublime.active_window().status_message(result)
print(result)
class WpmInstallCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
self.window = sublime.active_window()
view = self.window.show_input_panel(
"Install WP Plug-in:",
"",
self.on_done,
None,
None
)
def on_done(self, plugin_name):
wp_root_path = sublime.active_window().folders()[0]
command = 'wp plugin install {0} --path={1}'.format(plugin_name, wp_root_path)
result = subprocess.getoutput(command)
self.window.status_message(result)
print(result)
class WpmUpdatePluginsCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
command = 'wp plugin update --all --path={0}'.format(wp_root_path)
result = subprocess.getoutput(command)
sublime.message_dialog(result)
print(result)
class WpmUpdateThemesCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
command = 'wp theme update --all --path={0}'.format(wp_root_path)
result = subprocess.getoutput(command)
sublime.message_dialog(result)
print(result)
class WpmUpdateCoreCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
wp_root_path = sublime.active_window().folders()[0]
command = 'wp core update --path={0}'.format(wp_root_path)
result = subprocess.getoutput(command)
sublime.message_dialog(result)
print(result)