{# Example: remote_url = git@git01.iis.fhg.de:ks-ip-lib/software/sample_project.git #}
{# |----------------|---------|-----------------------| #}
{# domain group pages_path #}
{# |---------------------------------| #}
{# path #}
{# remote_url_https = https://git01.iis.fhg.de/ks-ip-lib/software/sample_project/ #}
{# remote_url_pages = https://ks-ip-lib.git01.iis.fhg.de/software/sample_project/ #}

{% set domain = (remote_url | replace("git@", "")).split(":")[0] %}
{% set path = remote_url.split(":")[1].replace(".git", "") %}
{% set group = path.split("/")[0] %}
{% set pages_path = "/".join(path.split("/")[1:]) %}

{% set remote_url_https = "https://" + domain + "/" + path %}

{% if remote == 'github' %}
{% set domain_pages = 'github.io' %}
{% set path_pipeline = '/actions?query=branch%3A' + default_branch %}
{% elif remote == 'gitlab-iis' %}
{% set domain_pages = domain %}
{% elif remote == 'gitlab-fhg' %}
{% set domain_pages = 'pages.fraunhofer.de' %}
{% endif %}

{% if remote.startswith('gitlab') %}
{% set path_pipeline = '/-/pipelines' %}
{% endif %}

{% set remote_url_pages = "https://" + group + "." + domain_pages + "/" + pages_path %}
{% set remote_url_pipeline = remote_url_https + path_pipeline %}

{% if remote == 'github' %}
{# coverage badge is provided by gitlab #}
## coverage badge is generated by github action and published on github pages
{% set remote_url_coverage_badge = remote_url_pages + '/badges/coverage.svg' %}
## pipeline badge is provided by github
{% set remote_url_pipeline_badge = remote_url_https + '/actions/workflows/ci.yaml/badge.svg' %}
{% else %}
## coverage and pipeline badges are provided by gitlab
{% set remote_url_coverage_badge = remote_url_https + '/badges/' + default_branch + '/coverage.svg' %}
{% set remote_url_pipeline_badge = remote_url_https + '/badges/' + default_branch + '/pipeline.svg' %}
{% endif %}

{% set cli_command = package_name | replace("_", "-") %}
