|
@@ -14,17 +14,18 @@ Function Open-Solution {
|
|
[CmdletBinding()]
|
|
[CmdletBinding()]
|
|
param(
|
|
param(
|
|
[Parameter(Mandatory=$false, HelpMessage="The path to the solution file to open.")]
|
|
[Parameter(Mandatory=$false, HelpMessage="The path to the solution file to open.")]
|
|
- [Uri]$SolutionFilePath = (Resolve-Path "../Terminal.sln")
|
|
|
|
|
|
+ [ValidatePattern(".*Terminal\.sln" )]
|
|
|
|
+ [string]$Path = $SolutionFilePath
|
|
)
|
|
)
|
|
|
|
|
|
if(!$IsWindows) {
|
|
if(!$IsWindows) {
|
|
[string]$warningMessage = "The Open-Solution cmdlet is only supported on Windows.`n`
|
|
[string]$warningMessage = "The Open-Solution cmdlet is only supported on Windows.`n`
|
|
- Attempt to open file $SolutionFilePath with the system default handler?"
|
|
|
|
|
|
+ Attempt to open file $Path with the system default handler?"
|
|
|
|
|
|
Write-Warning $warningMessage -WarningAction Inquire
|
|
Write-Warning $warningMessage -WarningAction Inquire
|
|
}
|
|
}
|
|
|
|
|
|
- Invoke-Item $SolutionFilePath
|
|
|
|
|
|
+ Invoke-Item $Path
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -62,6 +63,13 @@ Function Set-PowerShellEnvironment {
|
|
[CmdletBinding()]
|
|
[CmdletBinding()]
|
|
param()
|
|
param()
|
|
|
|
|
|
|
|
+ # Set up some common globals
|
|
|
|
+ New-Variable -Name ScriptsDirectory -Value $PSScriptRoot -Option ReadOnly -Scope Global -Visibility Public
|
|
|
|
+ New-Variable -Name RepositoryRootDirectory -Value (Join-Path -Resolve $ScriptsDirectory "..") -Option ReadOnly -Scope Global -Visibility Public
|
|
|
|
+ New-Variable -Name SolutionFilePath -Value (Join-Path -Resolve $RepositoryRootDirectory "Terminal.sln") -Option ReadOnly -Scope Global -Visibility Public
|
|
|
|
+ New-Variable -Name TerminalGuiProjectDirectory -Value (Join-Path -Resolve $RepositoryRootDirectory "Terminal.Gui") -Option ReadOnly -Scope Global -Visibility Public
|
|
|
|
+ New-Variable -Name TerminalGuiProjectFilePath -Value (Join-Path -Resolve $TerminalGuiProjectDirectory "Terminal.Gui.csproj") -Option ReadOnly -Scope Global -Visibility Public
|
|
|
|
+
|
|
# Set a custom prompt to indicate we're in our modified environment.
|
|
# Set a custom prompt to indicate we're in our modified environment.
|
|
# Save the normal one first, though.
|
|
# Save the normal one first, though.
|
|
# And save it as ReadOnly and without the -Force parameter, so this will be skipped if run more than once in the same session without a reset.
|
|
# And save it as ReadOnly and without the -Force parameter, so this will be skipped if run more than once in the same session without a reset.
|
|
@@ -132,6 +140,11 @@ Function Reset-PowerShellEnvironment {
|
|
}
|
|
}
|
|
|
|
|
|
Remove-Variable -Name PathVarSeparator -Scope Global -Force -ErrorAction SilentlyContinue
|
|
Remove-Variable -Name PathVarSeparator -Scope Global -Force -ErrorAction SilentlyContinue
|
|
|
|
+ Remove-Variable -Name RepositoryRootDirectory -Scope Global -Force -ErrorAction SilentlyContinue
|
|
|
|
+ Remove-Variable -Name SolutionFilePath -Scope Global -Force -ErrorAction SilentlyContinue
|
|
|
|
+ Remove-Variable -Name TerminalGuiProjectDirectory -Scope Global -Force -ErrorAction SilentlyContinue
|
|
|
|
+ Remove-Variable -Name TerminalGuiProjectFilePath -Scope Global -Force -ErrorAction SilentlyContinue
|
|
|
|
+ Remove-Variable -Name ScriptsDirectory -Scope Global -Force -ErrorAction SilentlyContinue
|
|
}
|
|
}
|
|
|
|
|
|
# This ensures the environment is reset when unloading the module.
|
|
# This ensures the environment is reset when unloading the module.
|
|
@@ -140,4 +153,4 @@ $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
|
|
Reset-PowerShellEnvironment
|
|
Reset-PowerShellEnvironment
|
|
}
|
|
}
|
|
|
|
|
|
-Set-PowerShellEnvironment
|
|
|
|
|
|
+Set-PowerShellEnvironment
|