Create a function for running ps user scripts

This commit is contained in:
Manuel Thalmann 2024-09-22 23:51:38 +02:00
parent 56e56c5cea
commit 731eb7e31a
5 changed files with 8 additions and 4 deletions

View file

@ -6,6 +6,10 @@ begin
functions -e configureSW
functions -e userConfig
function runPSUserConfig -a script name
pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ name=$args[1]; }' "$script" "$name"
end
function runInstaller -V dir -a action
set -l path (status stack-trace | head -n4 | tail -n1 | string replace --regex -- '^\s*called on line \d+ of file (.*)$' '$1')
set -l name (basename (dirname $path))

View file

@ -24,7 +24,7 @@ begin
end
function userConfig -S -V dir -a name
pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ name=$args[1]; }' "$dir/Manage.ps1" $name
runPSUserConfig "$dir/Manage.ps1" $name
end
runInstaller $argv

View file

@ -43,7 +43,7 @@ begin
end
function userConfig -V dir -a user
pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ name=$args[1]; }' "$dir/Main.ps1" $user
runPSUserConfig "$dir/Main.ps1" $user
end
runInstaller $argv

View file

@ -8,7 +8,7 @@ begin
end
function userConfig -S -V dir -a name
pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ name=$args[1]; }' "$dir/Manage.ps1" $name
runPSUserConfig "$dir/Manage.ps1" $name
end
runInstaller $argv

View file

@ -4,7 +4,7 @@ begin
source "$dir/../../Scripts/software.fish"
function userConfig -V dir -a user
pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ name=$args[1]; }' "$dir/Main.ps1" $user
runPSUserConfig "$dir/Main.ps1" $user
end
runInstaller $argv