Skip to content

Commit

Permalink
Merge Tig Kindel's work (#166)
Browse files Browse the repository at this point in the history
* Fixed #58: Multi-line commands rendering wrong
* Fixed #58 - Newlines in commands render incorrectly
* Added debug instructions to readme
* simplified stripping of newline/linefeed
* made column spacing tighter
* removed excess padding on right
* removed excess rows at bottom
* status bar wsa occluding window
* fixed build scripts to only build ocgv
* refactored to make logic more obvious
* removed orig files
* Updated references to latest Terminal.Gui
* Fixed #131 and upgraded to terminal.gui 1.6, pwsh 7.2, and net60
* supported .net and reverted change
* Fixes #131 - Out-ConsoleGridView doesn't handle ANSI escape sequences correctly
* removed border when minui is enabled
* re-implemented feature post merge screw up
* improve VS code build and debug support
* On exit, ensure only visible marked items are output
* Fixes 87
* Fixing crash when MinUi PR is merged
* Tweaked build to have a better test at end
* removed merge artifacts
* exclude .orig files (merge artifacts)

Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 22, 2022
1 parent ac7d4df commit 334f1a4
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 167 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ module/
# Ignore package
Microsoft.PowerShell.GraphicalTools.zip
Microsoft.PowerShell.ConsoleGuiTools.zip

# git artifacts
*.orig
29 changes: 12 additions & 17 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,20 @@
"configurations": [
{
"name": ".NET Core Launch (console)",
"preLaunchTask": "build ConsoleGuiTools",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Cmdlet/bin/Debug/net6.0/win10-x64/OutGridViewCmdlet.dll",
"args": [],
"cwd": "${workspaceFolder}/Cmdlet",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (application)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Application/bin/Debug/net6.0/win10-x64/OutGridViewApplication.dll",
"args": [],
"cwd": "${workspaceFolder}/Application",
"console": "internalConsole",
"stopAtEntry": false
"program": "pwsh",
"args": [
"-NoExit",
"-NoProfile",
"-Command",
"Import-Module ${workspaceFolder}/module/Microsoft.PowerShell.ConsoleGuiTools"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false,
"justMyCode": false
},
{
"name": ".NET Core Attach",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"files.associations": {
"**/.vsts-ci/**/*.yml":"azure-pipelines"
"**/.vsts-ci/**/*.yml":"azure-pipelines",
}
}
39 changes: 14 additions & 25 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"osx": {
"command": "/usr/local/bin/pwsh"
},
"windows": {
"command": "pwsh.exe"
},
"linux": {
"command": "/usr/local/bin/pwsh"
},
"type": "process",
"label": "build ConsoleGuiTools",
"command": "Invoke-Build",
"type": "shell",
"args": [
"-c",
"Invoke-Build",
// Build both modules
//"Build -ModuleName Microsoft.PowerShell.GraphicalTools, Microsoft.PowerShell.ConsoleGuiTools",
// Build only Out-GridView
//"Build -ModuleName Microsoft.PowerShell.GraphicalTools",
// Build only Out-ConsoleGridView
"Build -ModuleName Microsoft.PowerShell.ConsoleGuiTools",
"Build",
"-Module",
"Microsoft.PowerShell.ConsoleGuiTools"
],
"problemMatcher": "$msCompile",
"group": {
"kind": "build",
"isDefault": true
}
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
8 changes: 5 additions & 3 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Build...
Invoke-Build 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"
# Run what was built as a bit of test of:
# - Scale: recursive ls of the project
# - Filter: proving regex works
# - SelectMultiple
pwsh -noprofile -command "Import-Module -verbose '$PSScriptRoot/module/Microsoft.PowerShell.ConsoleGuiTools'; Get-ChildItem -Recurse | Out-ConsoleGridView -OutputMode Multiple -Title 'Imported Modules' -Filter \.xml"
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ to view and filter objects graphically.

## Development

### 1. Install PowerShell 7.1+
### 1. Install PowerShell 7.2+

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

### 2. Clone the GitHub repository

Expand All @@ -49,16 +49,18 @@ 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
```

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
Expand All @@ -72,29 +74,15 @@ PS ./GraphicalTools> code .

Build by hitting `Ctrl-Shift-B` in VS Code.

To debug:
Set a breakpoint and hit `F5` to start the debugger.

In a PowerShell session in the `./GraphicalTools` directory, run `pwsh` (thus
nesting PowerShell).

Then do the folowing:
Click on the VS Code "TERMINAL" tab and type your command that starts `Out-ConsoleGridView`, e.g.

```powershell
Import-Module ./module/Microsoft.PowerShell.ConsoleGuiTools
$pid
ls | ocgv
```

This will import the latest built DLL and output the process ID you'll need
for debugging. Copy this ID to the clipboard.

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.

In the PowerShell session run your commands; breakpoints will be hit, etc.

When done, run `exit` to exit the nested PowerShell and run `pwsh` again.
This unloads the DLL. Repeat.
Your breakpoint should be hit.

## Contributions Welcome

Expand Down
Loading

0 comments on commit 334f1a4

Please sign in to comment.