Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# or merged change.
# ------------------------------------------------------------------------------

__version__ = "1.2.3"
__version__ = "1.3.0"

# --- Dependencies -------------------------------------------------------------
# List other odev plugins from which this current plugin depends.
Expand Down
2 changes: 1 addition & 1 deletion commands/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run(self):
editor_class = Editor.__subclasses__()[0]

try:
editor = editor_class(self._database, self.args.repository)
editor = editor_class(self._database, self.args)
except ValueError as error:
raise self.error(str(error)) from error

Expand Down
9 changes: 7 additions & 2 deletions common/editor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from abc import ABC, abstractmethod
from argparse import Namespace
from pathlib import Path
from typing import ClassVar, Optional

Expand All @@ -20,17 +21,21 @@ class Editor(ABC):
_display_name: ClassVar[str]
"""Display name of the code editor."""

def __init__(self, database: DummyDatabase | LocalDatabase, repository: Optional[str] = None):
def __init__(self, database: DummyDatabase | LocalDatabase, cmd_args: Namespace):
"""Initialize the editor with a database or repository.
:param database: The database linked to the project to open in the editor.
:param repository: The repository to open in the editor.
:param cmd_args: Arguments from the `Editor` command.
"""
repository: Optional[str] = cmd_args.repository
if isinstance(database, LocalDatabase) and repository is not None:
raise ValueError("Cannot provide both database and repository")

self.database = database
"""The database linked to the project to open in the editor."""

self.cmd_args = cmd_args
"""The command arguments."""

self.repository: str = "odoo/odoo"
"""The repository to open in the editor."""

Expand Down