diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0056896..48c411a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,7 +7,7 @@ "command": "/usr/local/bin/pwsh" }, "windows": { - "command": "pwsh.exe" + "command": "C:/Program Files/PowerShell/7-preview/pwsh.exe" }, "linux": { "command": "/usr/local/bin/pwsh" diff --git a/Build.ps1 b/Build.ps1 index fd2eeff..d3e29a0 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -4,8 +4,8 @@ # To build only one, specify it using the -ModuleName paramater (e.g. Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools). # Build... -Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools +Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools # Run what was built... # pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.GraphicalTools'; Get-Module -all | Out-GridView -OutputMode Single -Title 'Imported Modules' -pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules' -Filter power" \ No newline at end of file +# pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-Module -all | Out-ConsoleGridView -OutputMode Single -Title 'Imported Modules'" diff --git a/README.md b/README.md index d762d96..4c9770f 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,10 @@ Now you're ready to build the code. You can do so in one of two ways: PS ./GraphicalTools> Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools ``` -From there you can import the module that you just built for example: +From there you can import the module that you just built for example (start a fresh `pwsh` instance first so you can unload the module with an `exit`; otherwise building again may fail because the `.dll` will be held open): ```powershell +pwsh Import-Module ./module/Microsoft.PowerShell.ConsoleGuiTools ``` @@ -59,6 +60,7 @@ And then run the cmdlet you want to test, for example: ```powershell Get-Process | Out-ConsoleGridView +exit ``` > NOTE: If you change the code and rebuild the project, you'll need to launch a diff --git a/scripts/azurePipelinesBuild.ps1 b/scripts/azurePipelinesBuild.ps1 index 788e64f..b963139 100644 --- a/scripts/azurePipelinesBuild.ps1 +++ b/scripts/azurePipelinesBuild.ps1 @@ -8,5 +8,5 @@ if (!(Get-Module -ListAvailable PlatyPS)) { Install-Module PlatyPS -Force -Scope CurrentUser } -Invoke-Build -Configuration Release +Invoke-Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools -Configuration Release Pop-Location diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs index 2ad6f0d..10ba3d4 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/ConsoleGui.cs @@ -205,23 +205,23 @@ private void AddFilter(Window win) Width = Dim.Fill() - _filterLabel.Text.Length }; - var filterErrorLabel = new Label(string.Empty) + // Note: See Issue #1769 in Terminal.Gui for why the constructor to Label can't take string.Empty + var filterErrorLabel = new Label(" ") { X = Pos.Right(_filterLabel) + 1, Y = Pos.Top(_filterLabel) + 1, - ColorScheme = Colors.Base, + ColorScheme = Colors.Error, Width = Dim.Fill() - _filterLabel.Text.Length }; _filterField.TextChanged += (str) => { // str is the OLD value - string filterText = _filterField.Text?.ToString(); try { - filterErrorLabel.Text = " "; - filterErrorLabel.ColorScheme = Colors.Base; - filterErrorLabel.Redraw(filterErrorLabel.Bounds); + string filterText = _filterField.Text?.ToString(); + filterErrorLabel.Text = ""; + filterErrorLabel.Visible = false; List itemList = GridViewHelpers.FilterData(_itemSource.GridViewRowList, filterText); _listView.Source = new GridViewDataSource(itemList); @@ -229,8 +229,7 @@ private void AddFilter(Window win) catch (Exception ex) { filterErrorLabel.Text = ex.Message; - filterErrorLabel.ColorScheme = Colors.Error; - filterErrorLabel.Redraw(filterErrorLabel.Bounds); + filterErrorLabel.Visible = true; _listView.Source = _itemSource; } }; diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 index cd72692..27e839f 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1 @@ -9,7 +9,7 @@ RootModule = 'Microsoft.PowerShell.ConsoleGuiTools.dll' # Version number of this module. -ModuleVersion = '0.6.3' +ModuleVersion = '0.7.2' # Supported PSEditions CompatiblePSEditions = @( 'Core' ) @@ -105,6 +105,13 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = '# Release Notes +## v0.7.0 + +Upugraded to PS 7.2 and net60 + +Updated Terminal.Gui to 1.6 + +Fixed #131 - Strip ANSI ## v0.6.3 diff --git a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs index d1c57a7..23e2997 100644 --- a/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs +++ b/src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System; +using System; using System.Management.Automation; using System.Management.Automation.Internal; using System.Linq; diff --git a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj index b762ac9..3869004 100644 --- a/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj +++ b/src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj @@ -5,7 +5,7 @@ - + diff --git a/src/OutGridView.Gui/OutGridView.Gui.csproj b/src/OutGridView.Gui/OutGridView.Gui.csproj index a275569..e5389c5 100644 --- a/src/OutGridView.Gui/OutGridView.Gui.csproj +++ b/src/OutGridView.Gui/OutGridView.Gui.csproj @@ -20,7 +20,7 @@ - +