🚀 add script for changing git users
This commit is contained in:
parent
1381c5474e
commit
29c51e7d7e
2 changed files with 38 additions and 1 deletions
|
@ -6,7 +6,8 @@ let
|
||||||
protonge = import ./protonge.nix { inherit pkgs; };
|
protonge = import ./protonge.nix { inherit pkgs; };
|
||||||
share = import ./share.nix { inherit pkgs; };
|
share = import ./share.nix { inherit pkgs; };
|
||||||
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
|
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
|
||||||
|
git-switch = import ./git-switch.nix { inherit pkgs; };
|
||||||
in {
|
in {
|
||||||
home-manager.users.moritz.home.packages =
|
home-manager.users.moritz.home.packages =
|
||||||
[ cheat cycleSinks protonge share sxhkdHelp ];
|
[ cheat cycleSinks protonge share sxhkdHelp git-switch ];
|
||||||
}
|
}
|
||||||
|
|
36
modules/cli/bin/git-switch.nix
Normal file
36
modules/cli/bin/git-switch.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "git-switch";
|
||||||
|
|
||||||
|
runtimeInputs = with pkgs; [ git fzf ];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
case "$(printf "GitHub\nUniversity" | fzf --prompt "Account: " --height 5)" in
|
||||||
|
"GitHub")
|
||||||
|
user="MoritzBoehme"
|
||||||
|
email="mail@moritzboeh.me"
|
||||||
|
key="0x213820E2795F5CF5"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"University")
|
||||||
|
user="Moritz Boehme"
|
||||||
|
email="mb18cele@studserv.uni-leipzig.de"
|
||||||
|
key="0xE07B20727F85831C"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Invalid choice!"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
git config --local user.name "$user"
|
||||||
|
echo "Set username to \"$user\"."
|
||||||
|
git config --local user.email "$email"
|
||||||
|
echo "Set email to \"$email\"."
|
||||||
|
git config --local user.signingkey "$key"
|
||||||
|
echo "Set key to \"$key\"."
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue