repo_tools/gpull

27 lines
643 B
Bash
Executable File

#!/bin/bash
if [[ -z "$1" ]]; then
project="$(basename $(pwd))"
else
project="$1"
shift
fi
token="$(pass show gitea/token/${project})"
if [[ -z "$token" ]]; then
printf 'Failed to get token for %s. ' "$project" >&2
print 'Must be one of:\n\n' "$project" >&2
pass show gitea/token >&2
exit 1
fi
gpg_key='75D6600BEF4E8E8F'
url="https://luke:${token}@git.drheck.dev/luke/${project}.git"
if [[ "$project" == 'pass' ]]; then
pass git config user.signingkey "$gpg_key"!
pass git config commit.gpgsign true
pass git pull "$url"
else
git config user.signingkey "$gpg_key"!
git config commit.gpgsign true
git pull "$url"
fi