@@ -115,8 +115,11 @@ class CpsRunCommandsCommand(sublime_plugin.TextCommand):
115
115
# 简单的安装指令
116
116
npm i -D @types/node12
117
117
118
- # 需要交互的命令前面添加 "$" 或者 ":"
118
+ # "$" 或者 ":" 前缀,调用新的shell窗口运行指令
119
+ # 后续cmd窗口会等待15秒后自动关闭
119
120
$npm init
121
+
122
+ # 后续cmd窗口需要用户按任意键才能关闭
120
123
:npm init
121
124
```
122
125
"""
@@ -129,7 +132,7 @@ def run(self, edit: sublime.Edit):
129
132
selection_with_index = [ f'{ index + 1 } . { HISTORY .data [index ]} ' for index in range (len (HISTORY .data ))]
130
133
131
134
if panel_name :
132
- window .run_command ('hide_panel' , {'panel' :panel_name })
135
+ window .run_command ('hide_panel' , { 'panel' :panel_name })
133
136
else :
134
137
self .show_selection ([MSG_SELECTIONS_TITLE ] + selection_with_index )
135
138
@@ -166,8 +169,8 @@ def show_input_panel(self, placeholder:str=""):
166
169
def on_select (self , user_select_index :int ):
167
170
# custom input
168
171
if user_select_index == - 1 :
169
- # return
170
- self .show_input_panel ()
172
+ return
173
+ # self.show_input_panel()
171
174
172
175
elif user_select_index == 0 :
173
176
self .show_input_panel ()
@@ -196,9 +199,14 @@ def run_command(self, user_input:str, panel_name:str=None):
196
199
197
200
# run in new shell window
198
201
if user_input [0 ][0 ] in RUN_IN_NEW_WINDOW_PREFIX :
202
+ if user_input [0 ][0 ] == ':' :
203
+ pause = True
204
+
205
+ if user_input [0 ][0 ] == '$' :
206
+ pause = 5
199
207
200
208
commands = str (user_input [1 :]).split (' ' )
201
- shell .run_command (commands , shell = True , pause = True , cwd = cwd )
209
+ shell .run_command (commands , shell = True , pause = pause , cwd = cwd )
202
210
203
211
return
204
212
0 commit comments