#!/usr/bin/env bash

ISSUE_ID=

while read line; do
    if [[ "$line" == X-Redmine-Issue-Id:* ]]; then
        ISSUE_ID=${line##*: }
    fi
done

if [[ $ISSUE_ID = "" ]]; then
    echo No issue id found
    exit 2
else
    nohup xdg-open "https://alm.waarp.fr/issues/$ISSUE_ID" 1>/dev/null 2>&1 &
fi
