Skip to content

Commit

Permalink
refactor(cli): Move force_update to CLI group
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Aug 21, 2024
1 parent 3c2950d commit a04e779
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions capella2polarion/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
@click.option("--polarion-pat", envvar="POLARION_PAT", type=str)
@click.option("--polarion-delete-work-items", is_flag=True, default=False)
@click.option("--capella-model", type=cli_helpers.ModelCLI(), default=None)
@click.option("--force-update", is_flag=True, default=False)
@click.option("--type-prefix", type=str, default="")
@click.option("--role-prefix", type=str, default="")
@click.pass_context
Expand All @@ -49,6 +50,7 @@ def cli(
polarion_pat: str,
polarion_delete_work_items: bool,
capella_model: capellambse.MelodyModel,
force_update: bool,
type_prefix: str,
role_prefix: str,
) -> None:
Expand All @@ -63,8 +65,9 @@ def cli(
polarion_pat,
polarion_delete_work_items,
capella_model,
type_prefix=type_prefix,
role_prefix=role_prefix,
force_update,
type_prefix,
role_prefix,
)
capella2polarion_cli.setup_logger()
ctx.obj = capella2polarion_cli
Expand All @@ -84,11 +87,9 @@ def print_cli_state(capella2polarion_cli: Capella2PolarionCli) -> None:
type=click.File(mode="r", encoding="utf8"),
default=None,
)
@click.option("--force-update", is_flag=True, default=False)
@click.pass_context
def synchronize(
ctx: click.core.Context,
force_update: bool,
synchronize_config: typing.TextIO,
) -> None:
"""Synchronise model elements."""
Expand All @@ -98,7 +99,6 @@ def synchronize(
capella_to_polarion_cli.polarion_params.project_id,
)
capella_to_polarion_cli.load_synchronize_config(synchronize_config)
capella_to_polarion_cli.force_update = force_update

converter = model_converter.ModelConverter(
capella_to_polarion_cli.capella_model,
Expand Down
4 changes: 2 additions & 2 deletions ci-templates/gitlab/synchronise_elements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ capella2polarion_synchronise_elements:
$([[ $CAPELLA2POLARION_DEBUG -eq 1 ]] && echo '--debug') \
--polarion-project-id=${CAPELLA2POLARION_PROJECT_ID:?} \
--capella-model="${CAPELLA2POLARION_MODEL_JSON:?}" \
$([[ $CAPELLA2POLARION_FORCE_UPDATE -eq 1 ]] && echo '--force-update') \
${CAPELLA2POLARION_TYPE_PREFIX:+--type-prefix="$CAPELLA2POLARION_TYPE_PREFIX"} \
${CAPELLA2POLARION_ROLE_PREFIX:+--role-prefix="$CAPELLA2POLARION_ROLE_PREFIX"} \
synchronize \
--synchronize-config=${CAPELLA2POLARION_CONFIG:?} \
$([[ $CAPELLA2POLARION_FORCE_UPDATE -eq 1 ]] && echo '--force-update')
--synchronize-config=${CAPELLA2POLARION_CONFIG:?}

0 comments on commit a04e779

Please sign in to comment.