-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsmartcomments.py
More file actions
52 lines (41 loc) · 1.43 KB
/
smartcomments.py
File metadata and controls
52 lines (41 loc) · 1.43 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
import sublime, sublime_plugin
from subprocess import PIPE, Popen
from os.path import dirname as path_dirname
def fn_execute(cmd_args=[], cmd=None):
"""
"""
result = None
try:
if cmd:
result = Popen(cmd_args, executable=cmd, stdout=PIPE, stderr=PIPE).communicate()
else:
result = Popen(cmd_args, stdout=PIPE, stderr=PIPE).communicate()
except (TypeError, err):
print ("Error %1 ocurrido al ejecutar el comando %2 ".args(err, cmd ))
except (FileNotFoundError, err):
print ("Error %1 ocurrido al ejecutar el comando %2 ".args(err, cmd ))
return result
class SmartCommentsFolderCommand(sublime_plugin.TextCommand):
"""
"""
def run(self, edit):
file_name = self.view.file_name()
if not file_name:
return
file_dir = path_dirname(file_name)
result = fn_execute(["smartcomments","-g", "-t", file_dir])
class SmartCommentsFileCommand(sublime_plugin.TextCommand):
"""
"""
def run(self, edit):
file_name = self.view.file_name()
if not file_name or not str(file_name).endswith("js"):
return
result = fn_execute(["smartcomments","-g", "-t", file_name])
class SmartCommentsTextCommand(sublime_plugin.TextCommand):
"""
"""
def run(self, edit):
file_name = self.view.file_name()
if not file_name or not str(file_name).endswith("js"):
return