Skip to content

Out~FarPanel walkthrough

Roman Kuzmin edited this page Mar 15, 2015 · 1 revision

Out-FarPanel is a PowerShellFar cmdlet which creates and shows a powerful object panel with input objects, on-the-fly.

Let's get and explore the running process objects. It is as simple as this:

ps: Get-Process | Out-FarPanel

The result is an opened panel which looks similar to what we would see in a console on Get-Process:

But this is not a console with formatted output. This is an object panel, the browser of any .NET objects, process objects in our case.

Navigate to the process Far.exe and press [Enter]. A new child panel is opened, a member panel which shows object properties (and methods, too, use [CtrlShiftM]):

Browsing of objects and properties is recursive, e.g. in this member panel navigate to the property Modules (a collection) and press [Enter]. As a result, a new object panel with module objects is opened:

Now we can enter a particular module and explore its properties. Or we can press [Esc] in order to close the current child panel and return to the parent panel. In order to close the whole stack of panels use [ShiftEsc].


Customization

The above example is very straightforward and the objects are visualized well right away. This is the case for quite a number of object types, types with predefined formatting schemes. PowerShellFar uses these formats on creating object panels.

What about objects not known to PowerShell? No problems, they are shown in a panel. But the default representation may be not perfect. In this case Out-FarPanel may be customized.


Let's play with a very useful pair of commands Group-Object | Out-FarPanel, for example in order to show processes grouped by names:

ps: Get-Process | Group-Object Name | Out-FarPanel

We get a useful panel where each group can be opened in a child panel and its objects explored there:

But in this particular case the column Group does not add much value. This space would be much more useful for long names (of some other items, process names are normally short). Let's keep only Count and Name:

ps: Get-Process | Group-Object Name | Out-FarPanel Count, Name

We get a panel with two specified columns. It's not exactly perfect, now Count is much wider than needed:

Why is this? Because the panel now deals not with known objects (GroupInfo) but with unknown raw data. With no clues the panel creates columns with equal widths.

Thus, we should tell the panel how to show columns. All the details are in the manuals and there are several possible ways. In this case the simplest is to specify one column kind:

ps: Get-Process | Group-Object Name | Out-FarPanel @{e='Count'; k='S'}, Name

Here is the customized panel:


Recommended alias

If Out-FarPanel is used often then it makes sense to define an alias. Add to %FARPROFILE%\FarNet\PowerShellFar\Profile.ps1 this command:

Set-Alias op Out-FarPanel -Description 'Send objects to an object panel'

Now in order to show processes in a panel it is enough to type:

ps: ps | op