Create a function for running ps user scripts
This commit is contained in:
parent
56e56c5cea
commit
731eb7e31a
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue