Merge branch 'alexAubin1-main-patch-05082' into 'main'

[FIX] cli: Require --database argument for commands that need it (run, psql, generate_module_analysis, install_from_csv)

See merge request odoo-openupgrade-wizard/odoo-openupgrade-wizard!87
This commit is contained in:
Rémy Taymans 2024-10-03 18:48:12 +00:00
commit 20a53ab0b6
6 changed files with 10 additions and 18 deletions

View File

@ -0,0 +1,2 @@
Require to specify the --database arg for every command that needs it
(install_from_csv, psql, run, generate_module_analysis)

View File

@ -2,7 +2,7 @@ import click
from loguru import logger
from odoo_openupgrade_wizard.cli.cli_options import (
database_option,
database_option_required,
get_migration_steps_from_options,
step_option,
)
@ -23,7 +23,7 @@ from odoo_openupgrade_wizard.tools.tools_system import ensure_folder_writable
@click.command()
@step_option
@database_option
@database_option_required
@click.option(
"-m",
"--modules",

View File

@ -2,7 +2,7 @@ import click
from loguru import logger
from odoo_openupgrade_wizard.cli.cli_options import (
database_option,
database_option_required,
demo_option,
get_migration_step_from_options,
)
@ -16,7 +16,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database
@click.command()
@database_option
@database_option_required
@demo_option
@click.pass_context
def install_from_csv(ctx, database, with_demo):

View File

@ -53,16 +53,6 @@ def demo_option(function):
return function
def database_option(function):
function = click.option(
"-d",
"--database",
type=str,
help="Odoo Database for which you want to perform the operation.",
)(function)
return function
def database_option_required(function):
function = click.option(
"-d",

View File

@ -1,11 +1,11 @@
import click
from odoo_openupgrade_wizard.cli.cli_options import database_option
from odoo_openupgrade_wizard.cli.cli_options import database_option_required
from odoo_openupgrade_wizard.tools.tools_postgres import execute_psql_command
@click.command(context_settings={"ignore_unknown_options": True})
@database_option
@database_option_required
@click.option("-c", "--command", "request")
@click.option("--pager/--no-pager", default=True)
@click.argument("psql_args", nargs=-1, type=click.UNPROCESSED)

View File

@ -2,7 +2,7 @@ import click
from loguru import logger
from odoo_openupgrade_wizard.cli.cli_options import (
database_option,
database_option_required,
demo_option,
get_migration_step_from_options,
step_option,
@ -13,7 +13,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database
@click.command()
@step_option
@database_option
@database_option_required
@demo_option
@click.option(
"--stop-after-init",