From 1d6c41974f70fe62cc66285a089cda3dfae91c11 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 20 Jul 2024 04:06:41 +0200 Subject: [PATCH] Add separate method for configuring git --- scripts/Common/OS/users.fish | 2 -- scripts/Common/Software/git/main.fish | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/Common/OS/users.fish b/scripts/Common/OS/users.fish index fe9a9791..22660581 100644 --- a/scripts/Common/OS/users.fish +++ b/scripts/Common/OS/users.fish @@ -24,6 +24,4 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0) while ! sudo passwd "$name" echo "An error occurred! Please try again." end - - source "$dir/../Software/git/main.fish" configure user "$name" end diff --git a/scripts/Common/Software/git/main.fish b/scripts/Common/Software/git/main.fish index ce394058..63c18e40 100644 --- a/scripts/Common/Software/git/main.fish +++ b/scripts/Common/Software/git/main.fish @@ -3,9 +3,9 @@ begin set -l dir (status dirname) 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" - set -l root + set -l root "valhalla" set -l user set -l configArgs @@ -13,12 +13,11 @@ begin sudo -u "$user" git config $configArgs $argv end - if [ -z "$scope" ] || [ "$scope" = "system" ] - set root "valhalla" + if [ -z "$user" ] set user "root" set configArgs "--system" else - set root "valhalla.users.$name" + set root "$root.users.$name" set user "$name" set configArgs "--global" set -l displayName "$root.displayName" @@ -82,5 +81,13 @@ begin end end + function configureSW -S -V dir + configureGit + end + + function userConfig -S -V dir -a name + configureGit "$name" + end + runInstaller $argv end