#!/bin/bash

SECRET="$(secret-tool lookup githubauth myaccountname)"
if [ "$SECRET" == "" ]
then
  echo "Secret not found"
  exit -1
fi
TOTP="$(oathtool -b --totp "$SECRET")"
echo -n "$TOTP" | xsel -i
if [ -t 1 ]
then
  echo "$TOTP"
fi
