Add separate method for configuring git

This commit is contained in:
Manuel Thalmann 2024-07-20 04:06:41 +02:00
parent 7560191834
commit 3968658531
2 changed files with 12 additions and 7 deletions

View file

@ -24,6 +24,4 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
while ! sudo passwd "$name" while ! sudo passwd "$name"
echo "An error occurred! Please try again." echo "An error occurred! Please try again."
end end
source "$dir/../Software/git/main.fish" configure user "$name"
end end

View file

@ -3,9 +3,9 @@ begin
set -l dir (status dirname) set -l dir (status dirname)
source "$(status dirname)/../../Scripts/software.fish" source "$(status dirname)/../../Scripts/software.fish"
function configureSW -S -V dir -a scope name function configureGit -S -V dir -a name
source "$dir/../../Scripts/config.fish" source "$dir/../../Scripts/config.fish"
set -l root set -l root "valhalla"
set -l user set -l user
set -l configArgs set -l configArgs
@ -13,12 +13,11 @@ begin
sudo -u "$user" git config $configArgs $argv sudo -u "$user" git config $configArgs $argv
end end
if [ -z "$scope" ] || [ "$scope" = "system" ] if [ -z "$user" ]
set root "valhalla"
set user "root" set user "root"
set configArgs "--system" set configArgs "--system"
else else
set root "valhalla.users.$name" set root "$root.users.$name"
set user "$name" set user "$name"
set configArgs "--global" set configArgs "--global"
set -l displayName "$root.displayName" set -l displayName "$root.displayName"
@ -82,5 +81,13 @@ begin
end end
end end
function configureSW -S -V dir
configureGit
end
function userConfig -S -V dir -a name
configureGit "$name"
end
runInstaller $argv runInstaller $argv
end end