Skip to content

Commit d3c1a82

Browse files
committed
Merge branch 'master' of tig:tig/GraphicalTools
2 parents da6e273 + 7c4bec7 commit d3c1a82

File tree

11 files changed

+80
-85
lines changed

11 files changed

+80
-85
lines changed

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "coreclr",
1010
"request": "launch",
1111
"preLaunchTask": "build",
12-
"program": "${workspaceFolder}/Cmdlet/bin/Debug/netcoreapp3.0/win10-x64/OutGridViewCmdlet.dll",
12+
"program": "${workspaceFolder}/Cmdlet/bin/Debug/net6.0/win10-x64/OutGridViewCmdlet.dll",
1313
"args": [],
1414
"cwd": "${workspaceFolder}/Cmdlet",
1515
"console": "internalConsole",
@@ -20,7 +20,7 @@
2020
"type": "coreclr",
2121
"request": "launch",
2222
"preLaunchTask": "build",
23-
"program": "${workspaceFolder}/Application/bin/Debug/netcoreapp3.0/win10-x64/OutGridViewApplication.dll",
23+
"program": "${workspaceFolder}/Application/bin/Debug/net6.0/win10-x64/OutGridViewApplication.dll",
2424
"args": [],
2525
"cwd": "${workspaceFolder}/Application",
2626
"console": "internalConsole",

GraphicalTools.build.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ param(
33
[ValidateSet("Debug", "Release")]
44
[string]$Configuration = "Debug",
55

6-
[string[]]$ModuleName = @(
7-
"Microsoft.PowerShell.GraphicalTools",
8-
"Microsoft.PowerShell.ConsoleGuiTools" )
6+
[string[]]$ModuleName = @(
7+
#"Microsoft.PowerShell.GraphicalTools",
8+
"Microsoft.PowerShell.ConsoleGuiTools" )
99
)
1010

1111
$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows
1212

13-
$script:TargetFramework = "netcoreapp3.0"
13+
$script:TargetFramework = "net6.0"
1414
$script:RequiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version
1515

1616
$script:ModuleLayouts = @{}
@@ -152,12 +152,12 @@ task LayoutModule -After Build {
152152
foreach ($projectName in $moduleLayout.NativeBuildAssets.Keys) {
153153
foreach ($targetPlatform in $moduleLayout.NativeBuildAssets[$projectName]) {
154154
$destDir = Join-Path $moduleBinPath $projectName $targetPlatform
155-
155+
156156
$null = New-Item -Force $destDir -Type Directory
157-
157+
158158
# Get the project build dir path
159159
$publishPath = [System.IO.Path]::Combine($PSScriptRoot, 'src', $projectName, 'bin', $Configuration, $script:TargetFramework, $targetPlatform, "publish\*" )
160-
160+
161161
Write-Host $publishPath
162162
# Binplace the asset
163163
Copy-Item -Recurse -Force $publishPath $destDir

README.md

Lines changed: 45 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,58 @@
11
# GraphicalTools
22

3-
The GraphicalTools repo contains several different graphical-related PowerShell modules including:
3+
The GraphicalTools repo contains `Microsoft.PowerShell.ConsoleGuiTools`: a
4+
module that provides console-based GUI experiences based on
5+
[Terminal.Gui (gui.cs)](https://github.com/migueldeicaza/gui.cs).
46

5-
* `Microsoft.PowerShell.GraphicalTools` - A module that provides GUI experiences based on Avalonia.
6-
* `Microsoft.PowerShell.ConsoleGuiTools` - A module that provides console-based GUI experiences based on [Terminal.Gui (gui.cs)](https://github.com/migueldeicaza/gui.cs).
7+
Note that a module named `Microsoft.PowerShell.GraphicalTools` used to be built
8+
and published out of this repo, but per [#101](https://github.com/PowerShell/GraphicalTools/issues/101)
9+
it is deprecated and unmaintained until such time that it can be rewritten on
10+
top of [.NET MAUI](https://devblogs.microsoft.com/dotnet/introducing-net-multi-platform-app-ui/).
711

812
## Installation
913

10-
### Microsoft.PowerShell.GraphicalTools
11-
12-
```powershell
13-
Install-Module Microsoft.PowerShell.GraphicalTools
14-
```
15-
16-
### Microsoft.PowerShell.ConsoleGuiTools
17-
1814
```powershell
1915
Install-Module Microsoft.PowerShell.ConsoleGuiTools
2016
```
2117

2218
## Features
2319

24-
### Microsoft.PowerShell.GraphicalTools
25-
26-
[Out-GridView documentation](docs/Microsoft.PowerShell.ConsoleGuiTools/Out-GridView.md)
27-
28-
#### Cross-Platform
29-
|Linux |Windows |Mac |
30-
|---|---|---|
31-
| ![linux-gif](https://powershell.github.io/PowerShell-Blog/Images/2019-08-13-OutGridView-Returns/OutGridViewLinux.gif) | ![window-gif](https://powershell.github.io/PowerShell-Blog/Images/2019-08-13-OutGridView-Returns/OutGridViewWindows.gif) | ![macos-gif](https://powershell.github.io/PowerShell-Blog/Images/2019-08-13-OutGridView-Returns/OutGridViewMac.gif)|
32-
33-
- Out-Gridview
34-
- View and filter objects
35-
- Generate reusable filter code
36-
37-
### Microsoft.PowerShell.ConsoleGuiTools
38-
39-
[Out-ConsoleGridView documentation](docs/Microsoft.PowerShell.ConsoleGuiTools/Out-ConsoleGridView.md)
20+
Cross-platform! Use the cmdlet
21+
[`Out-ConsoleGridview`](docs/Microsoft.PowerShell.ConsoleGuiTools/Out-ConsoleGridView.md)
22+
to view and filter objects graphically.
4023

4124
![screenshot of Out-ConsoleGridView](docs/Microsoft.PowerShell.ConsoleGuiTools/ocgv.gif)
4225

43-
#### Cross-Platform
44-
45-
- Out-ConsoleGridview
46-
- View and filter objects
47-
4826
## Development
4927

50-
### 1. Install PowerShell 6.2+
28+
### 1. Install PowerShell 7.1+
5129

52-
Install PowerShell 6.2+ with [these instructions](https://github.com/PowerShell/PowerShell#get-powershell).
30+
Install PowerShell 7.1+ with [these instructions](https://github.com/PowerShell/PowerShell#get-powershell).
5331

54-
### 3. Clone the GitHub repository:
32+
### 2. Clone the GitHub repository
5533

5634
```powershell
5735
git clone https://github.com/PowerShell/GraphicalTools.git
5836
```
5937

60-
### 4. Install [Invoke-Build](https://github.com/nightroman/Invoke-Build)
38+
### 3. Install [Invoke-Build](https://github.com/nightroman/Invoke-Build)
6139

6240
```powershell
6341
Install-Module InvokeBuild -Scope CurrentUser
6442
```
6543

6644
Now you're ready to build the code. You can do so in one of two ways:
6745

68-
### Building the code from PowerShell
46+
### 4. Building the code from PowerShell
6947

7048
```powershell
71-
PS C:\path\to\GraphicalTools> Invoke-Build Build
49+
PS ./GraphicalTools> Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools
7250
```
7351

74-
> Note: You can build a single module using the -ModuleName parameter:
75-
>
76-
> ```powershell
77-
> Invoke-Build Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools
78-
> ```
79-
8052
From there you can import the module that you just built for example:
8153

8254
```powershell
83-
Import-Module .\module\Microsoft.PowerShell.ConsoleGuiTools
55+
Import-Module ./module/Microsoft.PowerShell.ConsoleGuiTools
8456
```
8557

8658
And then run the cmdlet you want to test, for example:
@@ -90,52 +62,63 @@ Get-Process | Out-ConsoleGridView
9062
```
9163

9264
> NOTE: If you change the code and rebuild the project, you'll need to launch a
93-
> _new_ PowerShell process since the dll is already loaded and can't be unloaded.
94-
95-
### Debugging in Visual Studio Code
65+
> _new_ PowerShell process since the DLL is already loaded and can't be unloaded.
9666
67+
### 5. Debugging in Visual Studio Code
9768

9869
```powershell
99-
PS C:\path\to\GraphicalTools> code .
70+
PS ./GraphicalTools> code .
10071
```
10172

102-
Build by hitting `Ctrl-Shift-b` in VS Code.
73+
Build by hitting `Ctrl-Shift-B` in VS Code.
10374

10475
To debug:
10576

106-
In a Powershell session in the `c:\path\to\GraphicalTools` directory, run `pwsh` (thus nesting powershell).
77+
In a PowerShell session in the `./GraphicalTools` directory, run `pwsh` (thus
78+
nesting PowerShell).
10779

10880
Then do the folowing:
10981

11082
```powershell
111-
Import-Module .\module\Microsoft.PowerShell.ConsoleGuiTools
83+
Import-Module ./module/Microsoft.PowerShell.ConsoleGuiTools
11284
$pid
11385
```
11486

115-
This will import the latest built DLL and output the process ID you'll need for debugging. Copy this ID to the clipboard.
87+
This will import the latest built DLL and output the process ID you'll need
88+
for debugging. Copy this ID to the clipboard.
11689

117-
In VScode, set your breakpoints, etc... Then hit `F5`. In the VScode search box, paste the value printed by `$pid`. You'll see something like `pwsh.exe 18328`. Click that and the debug session will start.
90+
In VScode, set your breakpoints, etc. Then hit `F5`. In the VScode search
91+
box, paste the value printed by `$pid`. You'll see something like `pwsh.exe
92+
18328`. Click that and the debug session will start.
11893

119-
In the Powershell session run your commands; breakpoints will be hit, etc...
94+
In the PowerShell session run your commands; breakpoints will be hit, etc.
12095

121-
When done, run `exit` to exit the nested PowerShell and run `pwsh` again. This unloads the DLL. Repeat.
96+
When done, run `exit` to exit the nested PowerShell and run `pwsh` again.
97+
This unloads the DLL. Repeat.
12298

123-
## Contributions Welcome!
99+
## Contributions Welcome
124100

125-
We would love to incorporate community contributions into this project. If you would like to
126-
contribute code, documentation, tests, or bug reports, please read the [development section above](https://github.com/PowerShell/GraphicalTools#development) to learn more.
101+
We would love to incorporate community contributions into this project. If
102+
you would like to contribute code, documentation, tests, or bug reports,
103+
please read the [development section above](https://github.com/PowerShell/GraphicalTools#development)
104+
to learn more.
127105

128-
## Microsoft.PowerShell.GraphicalTools Architecture
106+
## (Deprecated) Microsoft.PowerShell.GraphicalTools Architecture
129107

130-
Due to the quirks of the PowerShell threading implementation, the design of GUIs in this application are non-standard. The cmdlet invokes an Avalonia application as a separate process to guarantee the GUI is running on the main thread. Graphical tools therefore consists of 3 .NET Projects.
108+
Due to the quirks of the PowerShell threading implementation, the design of
109+
GUIs in this application are non-standard. The cmdlet invokes an Avalonia
110+
application as a separate process to guarantee the GUI is running on the main
111+
thread. Graphical tools therefore consists of 3 .NET Projects.
131112

132113
- Microsoft.PowerShell.GraphicalTools - Cmdlet implementations
133114
- OutGridView.Gui - Implementation of the Out-GridView window
134115
- OutGridView.Models - Contains data contracts between the GUI & Cmdlet
135116

136117
## Maintainers
137118

138-
- [Tyler Leonhardt](https://github.com/tylerleonhardt) - [@TylerLeonhardt](http://twitter.com/tylerleonhardt)
119+
- [Andrew Schwartzmeyer](https://andschwa.com) - [@andschwa](https://github.com/andschwa)
120+
121+
Originally authored by [Tyler Leonhardt](http://twitter.com/tylerleonhardt).
139122

140123
## License
141124

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "3.1.102"
3+
"version": "6.0.100"
44
}
55
}

src/Microsoft.PowerShell.ConsoleGuiTools/GridViewDataSource.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ public GridViewDataSource(List<GridViewRow> itemList)
2020
GridViewRowList = itemList;
2121
}
2222

23-
public bool IsMarked(int item) => GridViewRowList[item].IsMarked;
23+
public int Length { get; }
2424

25-
public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width)
25+
public void Render(ListView container, ConsoleDriver driver, bool selected, int item, int col, int line, int width, int start)
2626
{
2727
container.Move(col, line);
2828
RenderUstr(driver, GridViewRowList[item].DisplayString, col, line, width);
2929
}
3030

31+
public bool IsMarked(int item) => GridViewRowList[item].IsMarked;
32+
3133
public void SetMark(int item, bool value)
3234
{
3335
GridViewRowList[item].IsMarked = value;

src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\GraphicalTools.Common.props" />
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Nstack.Core" Version="0.14.0" />
9-
<PackageReference Include="Terminal.Gui" Version="0.90.3" />
10-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.1" />
8+
<PackageReference Include="Nstack.Core" Version="0.17.*" />
9+
<PackageReference Include="Terminal.Gui" Version="1.7.*" />
10+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.*" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

src/Microsoft.PowerShell.ConsoleGuiTools/Microsoft.PowerShell.ConsoleGuiTools.psd1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
RootModule = 'Microsoft.PowerShell.ConsoleGuiTools.dll'
1010

1111
# Version number of this module.
12-
ModuleVersion = '0.6.2'
12+
ModuleVersion = '0.6.3'
1313

1414
# Supported PSEditions
1515
CompatiblePSEditions = @( 'Core' )
@@ -30,7 +30,7 @@ Copyright = '(c) Microsoft Corporation.'
3030
Description = 'Cross-platform Console Gui Tools for PowerShell'
3131

3232
# Minimum version of the PowerShell engine required by this module
33-
PowerShellVersion = '6.2'
33+
PowerShellVersion = '7.2'
3434

3535
# Name of the PowerShell host required by this module
3636
# PowerShellHostName = ''
@@ -106,8 +106,16 @@ PrivateData = @{
106106
# ReleaseNotes of this module
107107
ReleaseNotes = '# Release Notes
108108
109+
## v0.6.3
110+
111+
Unreleased!
112+
109113
## v0.6.2
110114
115+
Update Terminal.Gui to 1.0.
116+
117+
Disable mouse mode to fix bug with mouse movement being printed to console.
118+
111119
Gracefully fail when running in remote sessions.
112120
113121
## v0.6.1

src/Microsoft.PowerShell.ConsoleGuiTools/TypeGetter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Management.Automation;
6+
using System.Management.Automation.Internal;
67
using System.Linq;
78
using System.Globalization;
89
using System.Collections.Generic;
@@ -26,7 +27,7 @@ public FormatViewDefinition GetFormatViewDefinitionForObject(PSObject obj)
2627
var types = _cmdlet.InvokeCommand.InvokeScript(@"Microsoft.PowerShell.Utility\Get-FormatData " + typeName).ToList();
2728

2829
//No custom type definitions found - try the PowerShell specific format data
29-
if (types == null || types.Count == 0)
30+
if (types == null || types.Count == 0)
3031
{
3132
types = _cmdlet.InvokeCommand
3233
.InvokeScript(@"Microsoft.PowerShell.Utility\Get-FormatData -PowerShellVersion $PSVersionTable.PSVersion " + typeName).ToList();
@@ -62,7 +63,8 @@ public DataTableRow CastObjectToDataTableRow(PSObject ps, List<DataTableColumn>
6263
}
6364
else
6465
{
65-
valuePairs[dataColumn.ToString()] = new StringValue { DisplayValue = stringValue };
66+
var stringDecorated = new StringDecorated(stringValue);
67+
valuePairs[dataColumn.ToString()] = new StringValue { DisplayValue = stringDecorated.ToString(OutputRendering.PlainText) };
6668
}
6769
}
6870

src/Microsoft.PowerShell.GraphicalTools/Microsoft.PowerShell.GraphicalTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\GraphicalTools.Common.props" />
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

src/Microsoft.PowerShell.OutGridView.Models/Microsoft.PowerShell.OutGridView.Models.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="..\..\GraphicalTools.Common.props" />
33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
</PropertyGroup>
66
<ItemGroup>
77
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

0 commit comments

Comments
 (0)