identity: scaffolding subcommands
This commit is contained in:
parent
e9d16de77a
commit
4036ad73fc
|
@ -1,17 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
identities="$HOME/.local/share/git/identities";
|
||||||
echo "USAGE:";
|
|
||||||
echo " git identity <gpg key id>";
|
|
||||||
echo;
|
|
||||||
|
|
||||||
echo "current identity:";
|
|
||||||
echo " name = $(git config user.name)";
|
|
||||||
echo " email = $(git config user.email)";
|
|
||||||
echo " key = $(git config user.signingKey)";
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
function add_identity() {
|
||||||
uid_regex="([^\(]*)\s*(\((.*)\))?\s*<(.*)>";
|
uid_regex="([^\(]*)\s*(\((.*)\))?\s*<(.*)>";
|
||||||
|
|
||||||
uid=$(gpg --with-colons -K $1 | awk -F: '$1=="uid" {print $10; exit}');
|
uid=$(gpg --with-colons -K $1 | awk -F: '$1=="uid" {print $10; exit}');
|
||||||
|
@ -41,3 +32,15 @@ else
|
||||||
echo " key = $keyid";
|
echo " key = $keyid";
|
||||||
git config --local user.signingKey "$keyid";
|
git config --local user.signingKey "$keyid";
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
add)
|
||||||
|
add_identity $2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "USAGE:";
|
||||||
|
echo " git identity <command>";
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue