-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.py
More file actions
28 lines (19 loc) · 960 Bytes
/
code.py
File metadata and controls
28 lines (19 loc) · 960 Bytes
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
from odev.common.commands import DatabaseOrRepositoryCommand
from odev.plugins.odev_plugin_editor_base.common.editor import Editor
class EditorCommand(DatabaseOrRepositoryCommand):
"""Create configuration files to link the database with a project in the current source code editor
and open the editor with the project loaded.
"""
_name = "code"
def run(self):
editor_subclasses = Editor.__subclasses__()
if not editor_subclasses:
raise self.error("No editor is supported, please activate an editor plugin and retry")
elif len(editor_subclasses) > 1:
raise self.error("Multiple editor plugins are activated, please deactivate all but one and retry")
editor_class = Editor.__subclasses__()[0]
try:
editor = editor_class(self._database, self.args)
except ValueError as error:
raise self.error(str(error)) from error
editor.open()