diff options
| author | ruki <[email protected]> | 2021-05-08 21:32:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-05-08 21:32:25 +0800 |
| commit | f21aa19d54be924764fc92f2dfda52af6198899c (patch) | |
| tree | c2296ad891ea87d4a2e6ca1f67ef2ee0f75783af /scripts | |
| parent | 6a803af51efe12c76a48da851dbdf69242c4eebe (diff) | |
fix psm1 script path
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/installer.nsi | 3 | ||||
| -rw-r--r-- | scripts/xrepo-hook.psm1 | 105 |
2 files changed, 0 insertions, 108 deletions
diff --git a/scripts/installer.nsi b/scripts/installer.nsi index bd47e463b..a01b6feea 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -238,10 +238,7 @@ Section "XMake (required)" InstallExeutable File "..\core\build\xmake.exe" File "..\scripts\xrepo.bat" File "..\scripts\xrepo.ps1" - File "..\scripts\xrepo-hook.psm1" File /r /x ".DS_Store" "..\winenv" - CreateDirectory "$InstDir\scripts" - Rename "$InstDir\xrepo-hook.psm1" "$InstDir\scripts\xrepo-hook.psm1" WriteUninstaller "uninstall.exe" diff --git a/scripts/xrepo-hook.psm1 b/scripts/xrepo-hook.psm1 deleted file mode 100644 index 902ef3b16..000000000 --- a/scripts/xrepo-hook.psm1 +++ /dev/null @@ -1,105 +0,0 @@ - -## ENVIRONMENT MANAGEMENT ###################################################### - -<# - .SYNOPSIS - Enter a xrepo environment based on your current project. - - .EXAMPLE - Enter-XrepoEnvironment -#> -function Enter-XrepoEnvironment { - [CmdletBinding()] - param(); - - begin { - $script:xrepoOldEnvs = (Get-ChildItem -Path Env:); - - & $Env:XMAKE_EXE lua private.xrepo.action.env.info config; - if (-not $?) { - Exit 1; - } - - $xmakeColorTermBackup, $Env:XMAKE_COLORTERM = $Env:XMAKE_COLORTERM, "nocolor"; - $xrepoPrompt = (& $Env:XMAKE_EXE lua private.xrepo.action.env.info prompt | Out-String); - $Env:XMAKE_COLORTERM = $xmakeColorTermBackup; - if (-not $xrepoPrompt.StartsWith("[")) { - Write-Host $xrepoPrompt; - Exit 1; - } - - $activateCommand = (& $Env:XMAKE_EXE lua private.xrepo.action.env.info script.powershell | Out-String); - - Write-Verbose "[xrepo env script.powershell]`n$activateCommand"; - Invoke-Expression -Command $activateCommand; - - $Env:XMAKE_PROMPT_MODIFIER = $xrepoPrompt.Trim() + " "; - } - process {} - end {} -} - - -<# - .SYNOPSIS - Exit the current xrepo environment, if any. - - .EXAMPLE - Exit-XrepoEnvironment -#> -function Exit-XrepoEnvironment { - [CmdletBinding()] - param(); - - begin { - ForEach ($p in (Get-ChildItem Env:)) { - [Environment]::SetEnvironmentVariable($p.Name, $Null); - } - ForEach ($p in $script:xrepoOldEnvs) { - [Environment]::SetEnvironmentVariable($p.Name, $p.Value); - } - $Env:XMAKE_PROMPT_MODIFIER = ""; - } - process {} - end {} -} - - -if (Test-Path Function:\prompt) { - Rename-Item Function:\prompt XrepoPromptBackup -} else { - function XrepoPromptBackup() { - # Restore a basic prompt if the definition is missing. - "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "; - } -} - - -<# - .SYNOPSIS - Modifies the current prompt to show the current xmake project. - - .EXAMPLE - Add-XrepoEnvironmentToPrompt - - Causes the current session's prompt to display the current xmake project name. -#> -function Add-XrepoEnvironmentToPrompt() { - function global:prompt() { - if ($Env:XMAKE_PROMPT_MODIFIER) { - $Env:XMAKE_PROMPT_MODIFIER | Write-Host -NoNewline - } - XrepoPromptBackup; - } -} - - -## EXPORTS ################################################################### - -Export-ModuleMember ` - -Alias * ` - -Function ` - Add-XrepoEnvironmentToPrompt, ` - Enter-XrepoEnvironment, ` - Exit-XrepoEnvironment, ` - prompt |
