g* auto git commands added, some encoding stuff as well
This commit is contained in:
29
bin/gpush
Executable file
29
bin/gpush
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
printf 'Need a project:\n\n' >&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
|
||||
if [[ "$project" == 'pass' ]]; then
|
||||
if [[ -n "$@" ]]; then
|
||||
pass git push "$@" "https://luke:${token}@git.drheck.dev/luke/${project}.git"
|
||||
else
|
||||
pass git push "https://luke:${token}@git.drheck.dev/luke/${project}.git"
|
||||
fi
|
||||
else
|
||||
if [[ -n "$@" ]]; then
|
||||
git push "$@" "https://luke:${token}@git.drheck.dev/luke/${project}.git"
|
||||
else
|
||||
git push "https://luke:${token}@git.drheck.dev/luke/${project}.git"
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user