Re:PowerShell is open sourced and is available on Linux
by DHowett on Thursday August 18, 2016 @11:43PM
(#12317844)
By default, an object at the end of a pipeline will be printed to the screen in tabular format.
I believe types can specify which columns to display by default; if you want more info, there's always `Format-List`:
It's also possible to format any object via `ConvertTo-JSON`:
[ Parent
| on HN ]
Re:PowerShell is open sourced and is available on Linux
by useerup on Friday August 19, 2016 @10:22AM
(#12320174)
> I believe types can specify which columns to display by default;
Indeed, the default view (table/list/custom) can be specified, and for the view the default properties can be specified.
Consider how 'ls' produces a sequence of FileSystemInfo objects (when run against a disk file system). The view specifies that the list be grouped by "parent".
On the terminal this gives a nice list a la:
Directory: C:\Dell\Drivers\T7MFF\PhysX\files\Engine\v2.8.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12-12-2014 07:42 362232 NxCooking.dll
-a---- 12-12-2014 07:42 5520120 PhysXCore.dll
Directory: C:\Dell\Drivers\T7MFF\PhysX\files\Engine\v2.8.1
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12-12-2014 07:42 363256 NxCooking.dll
-a---- 12-12-2014 07:42 5823736 PhysXCore.dll
Directory: C:\Dell\Drivers\T7MFF\PhysX\files\Engine\v2.8.3
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12-12-2014 07:42 339192 PhysXCooking.dll
-a---- 12-12-2014 07:42 412408 PhysXCooking64.dll
-a---- 12-12-2014 07:42 5952248 PhysXCore64.dll
However, the underlying stream is still just a continous stream of FileSystemInfo's. It is the terminal display format definition that causes it formatting to break and write a directory heading whenever the next item has a different parent from the previous one.