Browse Source

remove ps alias, fix multishell wrapper for pwsh arguments

master
Julian Noble 2 months ago
parent
commit
f110c3f2e5
  1. 8
      src/bootsupport/modules/punk-0.1.tm
  2. 8
      src/modules/punk-0.1.tm
  3. 7
      src/modules/punk/mix/templates/utility/scriptappwrappers/multishell.cmd
  4. 8
      src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm
  5. 8
      src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm
  6. 8
      src/vfs/_vfscommon.vfs/modules/punk-0.1.tm
  7. 7
      src/vfs/_vfscommon.vfs/modules/punk/mix/templates/utility/scriptappwrappers/multishell.cmd

8
src/bootsupport/modules/punk-0.1.tm

@ -8272,12 +8272,14 @@ namespace eval punk {
#todo - powershell detection on other platforms
set has_powershell 0
}
#todo - distinguish non-preinstalled pwsh (powershell core) from powershell which is available by default
if {$has_powershell} {
#see also powershell runspaces etc:
# powershell runspaces e.g $rs=[RunspaceFactory]::CreateRunspace()
# $ps = [Powershell]::Create()
interp alias {} ps {} exec >@stdout pwsh -nolo -nop -c
interp alias {} pse {} exec >@stdout pwsh -nolo -nop -c
interp alias {} psx {} runx -n pwsh -nop -nolo -c
interp alias {} psr {} run -n pwsh -nop -nolo -c
interp alias {} psout {} runout -n pwsh -nop -nolo -c
@ -8285,8 +8287,8 @@ namespace eval punk {
interp alias {} psls {} shellrun::runconsole pwsh -nop -nolo -c ls
interp alias {} psps {} shellrun::runconsole pwsh -nop -nolo -c ps
} else {
set ps_missing "powershell missing (powershell is open source and can be installed on windows and most unix-like platforms)"
interp alias {} ps {} puts stderr $ps_missing
set ps_missing "powershell missing (powershell is MIT licensed open source and can be installed on windows and most unix-like platforms)"
interp alias {} pse {} puts stderr $ps_missing
interp alias {} psx {} puts stderr $ps_missing
interp alias {} psr {} puts stderr $ps_missing
interp alias {} psout {} puts stderr $ps_missing

8
src/modules/punk-0.1.tm

@ -8272,12 +8272,14 @@ namespace eval punk {
#todo - powershell detection on other platforms
set has_powershell 0
}
#todo - distinguish non-preinstalled pwsh (powershell core) from powershell which is available by default
if {$has_powershell} {
#see also powershell runspaces etc:
# powershell runspaces e.g $rs=[RunspaceFactory]::CreateRunspace()
# $ps = [Powershell]::Create()
interp alias {} ps {} exec >@stdout pwsh -nolo -nop -c
interp alias {} pse {} exec >@stdout pwsh -nolo -nop -c
interp alias {} psx {} runx -n pwsh -nop -nolo -c
interp alias {} psr {} run -n pwsh -nop -nolo -c
interp alias {} psout {} runout -n pwsh -nop -nolo -c
@ -8285,8 +8287,8 @@ namespace eval punk {
interp alias {} psls {} shellrun::runconsole pwsh -nop -nolo -c ls
interp alias {} psps {} shellrun::runconsole pwsh -nop -nolo -c ps
} else {
set ps_missing "powershell missing (powershell is open source and can be installed on windows and most unix-like platforms)"
interp alias {} ps {} puts stderr $ps_missing
set ps_missing "powershell missing (powershell is MIT licensed open source and can be installed on windows and most unix-like platforms)"
interp alias {} pse {} puts stderr $ps_missing
interp alias {} psx {} puts stderr $ps_missing
interp alias {} psr {} puts stderr $ps_missing
interp alias {} psout {} puts stderr $ps_missing

7
src/modules/punk/mix/templates/utility/scriptappwrappers/multishell.cmd

@ -800,7 +800,12 @@ if ($matches.count) {
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# If not elevated, relaunch with elevated privileges
# -Wait e.g for starting a service or other operations which remainder of script may depend on
Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoProfile -NoExit -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Path)" -Wait -Verb RunAs
$arguments = @("-NoProfile", "-NoExit", "-ExecutionPolicy", "Bypass")
$arguments += @("-File", $($MyInvocation.MyCommand.Path))
$arguments += $args
#Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoProfile -NoExit -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Path)" -Wait -Verb RunAs
Start-Process -FilePath "pwsh.exe" -ArgumentList $arguments -Wait -Verb RunAs
Exit # Exit the current non-elevated process
}
}

8
src/project_layouts/custom/_project/punk.project-0.1/src/bootsupport/modules/punk-0.1.tm

@ -8272,12 +8272,14 @@ namespace eval punk {
#todo - powershell detection on other platforms
set has_powershell 0
}
#todo - distinguish non-preinstalled pwsh (powershell core) from powershell which is available by default
if {$has_powershell} {
#see also powershell runspaces etc:
# powershell runspaces e.g $rs=[RunspaceFactory]::CreateRunspace()
# $ps = [Powershell]::Create()
interp alias {} ps {} exec >@stdout pwsh -nolo -nop -c
interp alias {} pse {} exec >@stdout pwsh -nolo -nop -c
interp alias {} psx {} runx -n pwsh -nop -nolo -c
interp alias {} psr {} run -n pwsh -nop -nolo -c
interp alias {} psout {} runout -n pwsh -nop -nolo -c
@ -8285,8 +8287,8 @@ namespace eval punk {
interp alias {} psls {} shellrun::runconsole pwsh -nop -nolo -c ls
interp alias {} psps {} shellrun::runconsole pwsh -nop -nolo -c ps
} else {
set ps_missing "powershell missing (powershell is open source and can be installed on windows and most unix-like platforms)"
interp alias {} ps {} puts stderr $ps_missing
set ps_missing "powershell missing (powershell is MIT licensed open source and can be installed on windows and most unix-like platforms)"
interp alias {} pse {} puts stderr $ps_missing
interp alias {} psx {} puts stderr $ps_missing
interp alias {} psr {} puts stderr $ps_missing
interp alias {} psout {} puts stderr $ps_missing

8
src/project_layouts/custom/_project/punk.shell-0.1/src/bootsupport/modules/punk-0.1.tm

@ -8272,12 +8272,14 @@ namespace eval punk {
#todo - powershell detection on other platforms
set has_powershell 0
}
#todo - distinguish non-preinstalled pwsh (powershell core) from powershell which is available by default
if {$has_powershell} {
#see also powershell runspaces etc:
# powershell runspaces e.g $rs=[RunspaceFactory]::CreateRunspace()
# $ps = [Powershell]::Create()
interp alias {} ps {} exec >@stdout pwsh -nolo -nop -c
interp alias {} pse {} exec >@stdout pwsh -nolo -nop -c
interp alias {} psx {} runx -n pwsh -nop -nolo -c
interp alias {} psr {} run -n pwsh -nop -nolo -c
interp alias {} psout {} runout -n pwsh -nop -nolo -c
@ -8285,8 +8287,8 @@ namespace eval punk {
interp alias {} psls {} shellrun::runconsole pwsh -nop -nolo -c ls
interp alias {} psps {} shellrun::runconsole pwsh -nop -nolo -c ps
} else {
set ps_missing "powershell missing (powershell is open source and can be installed on windows and most unix-like platforms)"
interp alias {} ps {} puts stderr $ps_missing
set ps_missing "powershell missing (powershell is MIT licensed open source and can be installed on windows and most unix-like platforms)"
interp alias {} pse {} puts stderr $ps_missing
interp alias {} psx {} puts stderr $ps_missing
interp alias {} psr {} puts stderr $ps_missing
interp alias {} psout {} puts stderr $ps_missing

8
src/vfs/_vfscommon.vfs/modules/punk-0.1.tm

@ -8272,12 +8272,14 @@ namespace eval punk {
#todo - powershell detection on other platforms
set has_powershell 0
}
#todo - distinguish non-preinstalled pwsh (powershell core) from powershell which is available by default
if {$has_powershell} {
#see also powershell runspaces etc:
# powershell runspaces e.g $rs=[RunspaceFactory]::CreateRunspace()
# $ps = [Powershell]::Create()
interp alias {} ps {} exec >@stdout pwsh -nolo -nop -c
interp alias {} pse {} exec >@stdout pwsh -nolo -nop -c
interp alias {} psx {} runx -n pwsh -nop -nolo -c
interp alias {} psr {} run -n pwsh -nop -nolo -c
interp alias {} psout {} runout -n pwsh -nop -nolo -c
@ -8285,8 +8287,8 @@ namespace eval punk {
interp alias {} psls {} shellrun::runconsole pwsh -nop -nolo -c ls
interp alias {} psps {} shellrun::runconsole pwsh -nop -nolo -c ps
} else {
set ps_missing "powershell missing (powershell is open source and can be installed on windows and most unix-like platforms)"
interp alias {} ps {} puts stderr $ps_missing
set ps_missing "powershell missing (powershell is MIT licensed open source and can be installed on windows and most unix-like platforms)"
interp alias {} pse {} puts stderr $ps_missing
interp alias {} psx {} puts stderr $ps_missing
interp alias {} psr {} puts stderr $ps_missing
interp alias {} psout {} puts stderr $ps_missing

7
src/vfs/_vfscommon.vfs/modules/punk/mix/templates/utility/scriptappwrappers/multishell.cmd

@ -800,7 +800,12 @@ if ($matches.count) {
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# If not elevated, relaunch with elevated privileges
# -Wait e.g for starting a service or other operations which remainder of script may depend on
Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoProfile -NoExit -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Path)" -Wait -Verb RunAs
$arguments = @("-NoProfile", "-NoExit", "-ExecutionPolicy", "Bypass")
$arguments += @("-File", $($MyInvocation.MyCommand.Path))
$arguments += $args
#Start-Process -FilePath "pwsh.exe" -ArgumentList "-NoProfile -NoExit -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Path)" -Wait -Verb RunAs
Start-Process -FilePath "pwsh.exe" -ArgumentList $arguments -Wait -Verb RunAs
Exit # Exit the current non-elevated process
}
}

Loading…
Cancel
Save