detect project from leaf dir if no project specified
This commit is contained in:
parent
b9ab70213c
commit
2bf4e928dd
6
gclone
6
gclone
@ -8,9 +8,12 @@ fi
|
||||
|
||||
project="$1"
|
||||
shift
|
||||
|
||||
token="$(pass show gitea/token/${project})"
|
||||
if [[ -z "$token" ]]; then
|
||||
printf 'Failed to get token.\n'
|
||||
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
|
||||
token_url="https://luke:${token}@git.drheck.dev/luke/${project}.git"
|
||||
@ -37,4 +40,3 @@ else
|
||||
git remote remove origin
|
||||
git push --set-upstream "$url" main
|
||||
fi
|
||||
|
||||
|
24
gpull
24
gpull
@ -1,31 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
printf 'Need a project:\n\n' >&2
|
||||
pass show gitea/token >&2
|
||||
exit 1
|
||||
project="$(basename $(pwd))"
|
||||
else
|
||||
project="$1"
|
||||
shift
|
||||
fi
|
||||
|
||||
gpg_key='75D6600BEF4E8E8F'
|
||||
git config user.signingkey "$gpg_key"!
|
||||
git config commit.gpgsign true
|
||||
|
||||
project="$1"
|
||||
shift
|
||||
unset token
|
||||
token="$(pass show gitea/token/${project})"
|
||||
if [[ -z "$token" ]]; then
|
||||
printf 'Failed to get token.\n'
|
||||
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
|
||||
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
|
||||
if [[ -n "$@" ]]; then
|
||||
pass git pull "$@" "$url"
|
||||
else
|
||||
pass git pull "$url"
|
||||
fi
|
||||
else
|
||||
gpg_key='75D6600BEF4E8E8F'
|
||||
git config user.signingkey "$gpg_key"!
|
||||
git config commit.gpgsign true
|
||||
if [[ -n "$@" ]]; then
|
||||
git pull "$@" "$url"
|
||||
else
|
||||
|
26
gpush
26
gpush
@ -1,31 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
printf 'Need a project:\n\n' >&2
|
||||
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
|
||||
|
||||
project="$1"
|
||||
shift
|
||||
unset token
|
||||
token="$(pass show gitea/token/${project})"
|
||||
if [[ -z "$token" ]]; then
|
||||
printf 'Failed to get token.\n'
|
||||
exit 1
|
||||
fi
|
||||
gpg_key='75D6600BEF4E8E8F'
|
||||
git config user.signingkey "$gpg_key"!
|
||||
git config commit.gpgsign true
|
||||
|
||||
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
|
||||
if [[ -n "$@" ]]; then
|
||||
pass git push "$@" "$url"
|
||||
else
|
||||
pass git push "$url"
|
||||
fi
|
||||
else
|
||||
git config user.signingkey "$gpg_key"!
|
||||
git config commit.gpgsign true
|
||||
if [[ -n "$@" ]]; then
|
||||
git push "$@" "$url"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user