identity: fix formatting
This commit is contained in:
parent
f050ea3ea7
commit
6b02a8996f
|
@ -5,7 +5,7 @@ mkdir -p "$identities";
|
||||||
|
|
||||||
function yes_or_no { # courtesy of: https://stackoverflow.com/a/29436423
|
function yes_or_no { # courtesy of: https://stackoverflow.com/a/29436423
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$* [y/n]: " yn
|
read -p "$* [y/n]: " yn;
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*) return 0 ;;
|
[Yy]*) return 0 ;;
|
||||||
[Nn]*) return 1 ;;
|
[Nn]*) return 1 ;;
|
||||||
|
@ -17,7 +17,7 @@ function get_identity() {
|
||||||
filepath="$identities/$1";
|
filepath="$identities/$1";
|
||||||
identity="$1"; # TODO: match from partial names and set this to the correct one
|
identity="$1"; # TODO: match from partial names and set this to the correct one
|
||||||
sigkey=$(git config -f "$filepath" user.signingKey);
|
sigkey=$(git config -f "$filepath" user.signingKey);
|
||||||
name=$(git config -f "$filepath" user.name)
|
name=$(git config -f "$filepath" user.name);
|
||||||
email=$(git config -f "$filepath" user.email);
|
email=$(git config -f "$filepath" user.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ function import_identity() {
|
||||||
local name=$(printf "$uid" | sed -Ee "s/$uid_regex/\1/" | xargs);
|
local name=$(printf "$uid" | sed -Ee "s/$uid_regex/\1/" | xargs);
|
||||||
local email=$(printf "$uid" | sed -Ee "s/$uid_regex/\4/");
|
local email=$(printf "$uid" | sed -Ee "s/$uid_regex/\4/");
|
||||||
|
|
||||||
git config -f "$filepath" user.name "$name"
|
git config -f "$filepath" user.name "$name";
|
||||||
git config -f "$filepath" user.email "$email"
|
git config -f "$filepath" user.email "$email";
|
||||||
|
|
||||||
local keyid=$(gpg -K --with-colon $1 | awk -F: '$12~/.*s.*/ {print $5; exit}');
|
local keyid=$(gpg -K --with-colon $1 | awk -F: '$12~/.*s.*/ {print $5; exit}');
|
||||||
# TODO: if multiple found, bring up a dialog to select the right key
|
# TODO: if multiple found, bring up a dialog to select the right key
|
||||||
|
@ -87,9 +87,9 @@ case $1 in
|
||||||
import)
|
import)
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
echo "USAGE:";
|
echo "USAGE:";
|
||||||
echo " git identity import <gpg_key_id> [identity_file_name]"
|
echo " git identity import <gpg_key_id> [identity_file_name]";
|
||||||
echo;
|
echo;
|
||||||
echo "Imports an identity from a gpg key. If no filename is provided, it will by default to the identifier you provided for your gpg key"
|
echo "Imports an identity from a gpg key. If no filename is provided, it will by default to the identifier you provided for your gpg key";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -126,12 +126,12 @@ case $1 in
|
||||||
echo;
|
echo;
|
||||||
echo "Saved identities can be found here: $identities";
|
echo "Saved identities can be found here: $identities";
|
||||||
echo;
|
echo;
|
||||||
echo "COMMANDS:"
|
echo "COMMANDS:";
|
||||||
echo " import: import an identity from a gpg key"
|
echo " import: import an identity from a gpg key";
|
||||||
echo " remove: removes a saved identity";
|
echo " remove: removes a saved identity";
|
||||||
echo " set: sets the identity of the current git repo"
|
echo " set: sets the identity of the current git repo";
|
||||||
echo " show: show a saved identity or the identity of the current repo"
|
echo " show: show a saved identity or the identity of the current repo";
|
||||||
echo " list: list all saved identities"
|
echo " list: list all saved identities";
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue