added link cmd

This commit is contained in:
Luke Tidd 2022-11-18 17:03:00 -05:00
parent 3db78cdda9
commit 45f65f9890
Signed by: luke
GPG Key ID: 75D6600BEF4E8E8F
2 changed files with 34 additions and 1 deletions

10
gpush
View File

@ -15,12 +15,20 @@ if [[ -z "$token" ]]; then
fi fi
gpg_key='75D6600BEF4E8E8F' gpg_key='75D6600BEF4E8E8F'
url="https://luke:${token}@git.drheck.dev/luke/${project}.git" url="https://luke:${token}@git.drheck.dev/luke/${project}.git"
if [[ "$project" == 'pass' ]]; then if [[ "$project" == 'pass' ]]; then
pass git config user.signingkey "$gpg_key"! pass git config user.signingkey "$gpg_key"!
pass git config commit.gpgsign true pass git config commit.gpgsign true
pass git push "$url" pass git push "$url"
if [[ $? != 0 ]]; then
printf 'no upstream. setting..\n' >&2
git push --set-upstream "$url" main
fi
else else
git config user.signingkey "$gpg_key"! git config user.signingkey "$gpg_key"!
git config commit.gpgsign true git config commit.gpgsign true
git push "$url" git push "$url"
if [[ $? != 0 ]]; then
printf 'no upstream. setting..\n' >&2
git push --set-upstream "$url" main
fi
fi fi

25
link Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
local_bins=(
"${HOME}/bin"
"${HOME}/.local/bin"
)
here="$(pwd)"
for local_bin in "${local_bins[@]}"; do
if [[ -d "$local_bin" ]]; then
for bin in gclone gpush gpull; do
if [[ -f "${here}/${bin}" ]]; then
rm "${local_bin}/${bin}" &>/dev/null
ln -s "${here}/${bin}" "${local_bin}/${bin}"
else
printf '%s not found here. Can not make symlinks.\n' >&2
exit 1
fi
done
printf 'Done.\n'
exit 0
fi
done
printf 'No local bin found.\n' >&2
exit 1