#!/usr/bin/env bash

# Check ping command
paperwork-gtk ping

# Check that paperwork command line detects all dependencies
# For that we need to enable the plugin that is disabled by default in Debian
paperwork-json plugins add openpaperwork_core.cmd.chkdeps

dpkgarch=$(dpkg --print-architecture)
if [ "$dpkgarch" = riscv64 ]; then
    LANG=C paperwork-json chkdeps | jq -e '.missing.libreoffice.debian == "libreoffice"'
else
    LANG=C paperwork-json chkdeps | jq -e '.missing == {}'
fi
if [[ "$?" -eq "0" ]]; then
    echo "No missing dependencies"
else
    echo "Missing cli dependencies!"
    paperwork-json chkdeps
    exit 1
fi
