Skip to content

Commit

Permalink
godoo bootstrap Add Banner functionality
Browse files Browse the repository at this point in the history
- Add Banner with Text and color by Env Variables. Useful for Dev instances
  • Loading branch information
joshkreud committed Aug 24, 2024
1 parent 66b17da commit 611641c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 72 deletions.
70 changes: 0 additions & 70 deletions scripts/migrations/development/add_banner.py

This file was deleted.

12 changes: 11 additions & 1 deletion src/godoo_cli/cli_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from typing import List, Optional

from typer import Option
from typer import Argument, Option
from typer_common_functions import get_type_from_default, typer_retuner, typer_unpacker


Expand Down Expand Up @@ -42,6 +42,16 @@ class OdooLaunchArgs:
rich_help_panel="Odoo",
)
log_file_path: Path = Option(None, dir_okay=False, writable=True, help="Logfile Path", rich_help_panel="Odoo")
banner_text: str = Argument(
...,
help="Banner Text to add to Odoo Log",
envvar="ODOO_BANNER_TEXT",
)
banner_bg_color: str = Option(
"green",
help="Banner Background Color",
envvar="ODOO_BANNER_BG_COLOR",
)


@dataclass
Expand Down
8 changes: 7 additions & 1 deletion src/godoo_cli/commands/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..helpers.modules_py import _install_py_reqs_by_odoo_cmd
from ..helpers.system import run_cmd
from .db.connection import DBConnection
from .shell.shell import odoo_shell_run_script

CLI = CommonCLI()

Expand Down Expand Up @@ -142,11 +143,12 @@ def bootstrap_odoo(
install_base_modules: Annotated[
bool,
typer.Option(
...,
help="Install base and web modules if no other -i or -u is present in Bootstrap",
rich_help_panel="Odoo",
),
] = True,
banner_text=CLI.odoo_launch.banner_text,
banner_bg_color=CLI.odoo_launch.banner_bg_color,
):
"""Bootstrap Odoo."""

Expand Down Expand Up @@ -186,4 +188,8 @@ def bootstrap_odoo(
ret = run_cmd(cmd_string).returncode
if ret != 0:
LOGGER.error("Odoo-Bin Returned %d", ret)
if banner_text:
os.environ["ODOO_BANNER_TEXT"] = banner_text
os.environ["ODOO_BANNER_BG_COLOR"] = banner_bg_color
odoo_shell_run_script(script_name="odoo_banner", odoo_main_path=odoo_main_path, odoo_conf_path=odoo_conf_path)
return CLI.returner(ret)

0 comments on commit 611641c

Please sign in to comment.