Powershell: Enable console GUIs with PowerShell

Created on 6 Jun 2017  路  34Comments  路  Source: PowerShell/PowerShell

As people are going back to the console for management (instead of primarily GUI), we should support curses to enable console based GUIs.

  • [ ] out-gridview implementation
  • [ ] get-member interactive navigation
  • [ ] get-help -showwindow (for this, my suggestion is to not literally implement showwindow, but to improve console rendering of help with interactive navigation)
  • [ ] show-command
Issue-Enhancement Resolution-Answered WG-Interactive-Console

Most helpful comment

@oising and I started down this path starting with Jexer - https://github.com/klamonte/jexer. Well, @oising did the heavy lifting by converting the java to c#, I got it working on Linux/Mac pretty nicely. I had started with curses but that seemed way, way harder because _none_ of the _useful_ primitives are available and it's all native library interface which just adds more code. I haven't had time to look at it for a couple months.

I pretty much looked at everything (include CursesSharp), jexer is the moral descendant of Borland's tvision (which I remember pretty well). It seemed furthest along

All 34 comments

Show-Command?

People are not "going back" to consoles for management! They are forced to use it as there is no real alternatives!

In one of the posted issues: https://github.com/PowerShell/PowerShell/issues/1808

I mention about using Python Tk with PowerShell. I think Python would be a BIG candidate to help overcoming the missing GUI component in PowerShell.

myazuredemo_02_2017-06-11_12-03-51

:)

I guess Microsoft love Xamarin 馃槃

Yes to enabling a seperate searchable help window a la -showwindow. That's a useful capability

Even though I already 馃憤 this months ago, I wanted to let you guys know that Out-Gridview is a command that lots of people use to quickly preview and filter datasets. It's become a great asset in the typical admin toolbelt :-)

One of my typical use cases is to use Select-FromGridView (which is based on ogv but keeps the objects intact) to manually pick desired items from a collection of VMware Snapshots that I want to delete.

I view curses as only a stop-gap measure. OGV based on curses is going to be quite weak in comparison to OGV on FullCLR (and yes, I'm another person that uses OGV extensively when developing solutions to examine result data-sets, even though OGV may not end up in my published solution). Whether it's tk or something else, I believe you will need to pick a true xplat gui solution.

Haven't used PS6 yet, but this is going to be missed when i do migrate

I hope ogv can be implemented in some way. It is really convenient sometimes

@swngdnz for "true xplat gui", there's really only two viable solutions: vt100 and html. With vt100, it'll work across SSH, locally, as well as in CloudShell. Html is more limited as it'll only work locally, but it also simpler to implement. I encourage someone from the community to build such a module.

With a curses-type solution, it isn't as limited as you may think. Mouse navigation is supported in addition to keyboard. Yes, the graphics won't be as rich as WPF based, but OGV isn't a graphics intense app.

Possible alternative to curses https://github.com/chjj/blessed

Note that @JamesWTruher has already started some work here and we aren't actually using curses but a higher level framework that works on Linux/Mac/Windows. Hopefully we'll have something to show in the next few months.

Cool! Reusable console GUI framework would be awesome! Especially if it supported WPF (XAML) to easily port old GUIs or HTML to make it easy to use.

@SteveL-MSFT If "I encourage someone from the community to build such a module." is actual I suggest open new Issue with specifications and "Up-for-Grabs".

Was not the idea that Phosphor would offer something like this?

@stefanstranger yes for non-console. Not sure if @daviwil is still working on it, though since it was his side project.

Nah, unfortunately I haven't had the time. It's possible I could get around to it later this year but maybe someone else will step up and take over before then :)

@SteveL-MSFT @JamesWTruher

we aren't actually using curses but a higher level framework that works on Linux/Mac/Windows

Do you develop a new lib or use an old one ?
A lot of existing ncurses library used GPL3.0 licence ( CursesSharp for example )

We need a robust VT100 library for PowerShell project and for community module.

I would like something like this for community :
A sort of ShowUI for Text UI
https://github.com/fmichaleczek/PSClrCli/blob/master/Samples/Sample3.ps1

@oising and I started down this path starting with Jexer - https://github.com/klamonte/jexer. Well, @oising did the heavy lifting by converting the java to c#, I got it working on Linux/Mac pretty nicely. I had started with curses but that seemed way, way harder because _none_ of the _useful_ primitives are available and it's all native library interface which just adds more code. I haven't had time to look at it for a couple months.

I pretty much looked at everything (include CursesSharp), jexer is the moral descendant of Borland's tvision (which I remember pretty well). It seemed furthest along

Sounds exciting Jim, can't wait to see it!

@fmichaleczek funny, I was just looking into CLRCLI to implement a POC of Out-Gridview for x-plat. It seems to be pretty well developed already and works in .NET core.

@mattmcnabb It's not a bad looking library. Sadly it won't work over stream oriented connections such as ssh, raw sockets, telnet, x11/xterm etc. And the console APIs are dog slow :( Jexer (now Nexer) generates everything with ansi x3.64/ecma48 sequences, and does it with native C# - no external libraries. It's looking pretty promising so far.

CRCLI looks good.

@migueldeicaza has gui.cs targeting .net core.

@gulshan yes, we've explicitly been looking at gui.cs, but it doesn't currently have all the controls needed to port out-gridview (for example), but as a general library, I don't see any reason why someone wouldn't start using it today in their module

Hum!! @SteveL-MSFT ... does this count as a "Experimental Flag" feature.
I'm up for it!

@MaximoTrinidad in this case, you can write a module that uses gui.cs for rendering and it would not need to be behind an Experimental Flag because it should be a new cmdlet (call it something other than Out-GridView, maybe Show-GridView?) without any PowerShell engine changes.

New name will difficult to discover. Perhaps it should be proxy to add new parameter -gui.

With dotnet core 3 preview 5 out now and shipping working WPF on dotnet core, is this something that should work now?

I can import PresentationFramework.dll but I get errors when trying to run XamlReader::Load

powershell The following exception occurred while retrieving member "Load": "Could not load type 'MS.Internal.SecurityCriticalDataForSet`1' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

@1RedOne you would need to use the feature-netcore30 working branch which has .NET Core 3.0 but isn't ready to be merged. Also .NET Core 3.0 doesn't have a complete implementation of WPF yet.

@SteveL-MSFT Could you please update the issue description with current status and intentions?

@iSazonov this is post PS7, no work (from my team) is currently happening for this

For console ui's, I'd like to point you to this: https://appliedgo.net/tui/
It shows what we can get out of it and how it could look like.

This could also help resolving #12113

Applied Go
Beef up your Go console application with a Text-Based UI

Closing as work is happening here https://github.com/PowerShell/GraphicalTools/tree/master/src/Microsoft.PowerShell.ConsoleGuiTools

GitHub
A module that mixes PowerShell and GUIs! - built on Avalonia and gui.cs - PowerShell/GraphicalTools
Was this page helpful?
0 / 5 - 0 ratings