You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1571,4 +1571,4 @@ If you find this module useful, you might also want to look at my tools for [cre
1571
1571
1572
1572
Where possible these commands have been tested with PowerShell 7, but not every platform. If you encounter problems, have suggestions or other feedback, please post an [issue](https://github.com/jdhitsolutions/PSScriptTools/issues). It is assumed you will __not__ be running this commands on any edition of PowerShell Core or any beta releases of PowerShell 7.
When defining custom objects with a new typename, PowerShell by default will display all properties. However, you may wish to have a specific default view, be it a table or list. Or you may want to have different views display the object differently. Format directives are stored in format.ps1xml files which can be tedious to create. This command simplifies that process.
25
25
26
-
Pipe an instance of your custom object to this function and it will generate a format.ps1xml file based on either all the properties or a subset that you provide. When creating the file make sure the object you are modeling with does not have empty property values. You can repeat the process to add additional views. When finished, edit the format.ps1xml file and fine tune it. The file will have notes on how to substitute script blocks. If you run this command inside the Visual Studio Code PowerShell Integrated Console and use -Passthru, the new file will automatically be opened in your editor.
26
+
Pipe an instance of your custom object to this function and it will generate a format.ps1xml file based on either all the properties or a subset that you provide. You can repeat the process to add additional views. When finished, edit the format.ps1xml file and fine tune it. The file will have notes on how to substitute script blocks. If you run this command inside the Visual Studio Code PowerShell Integrated Console and use -Passthru, the new file will automatically be opened in your editor.
27
27
28
-
Note that table views are set to Autosize. But the table definition will include best guesses for column widths. If you prefer a more granular approach you can delete the Autosize tag and experiment with varying widths. Don't forget to run Update-FormatData to load your new file. You may need to start a new PowerShell session to test changes.
28
+
Note that table views are set to Autosize. But the table definition will include best guesses for column widths. If you prefer a more granular approach you can delete the Autosize tag and experiment with varying widths. Don't forget to run Update-FormatData to load your new file. You may need to start a new PowerShell session to fully test changes.
29
29
30
30
## EXAMPLES
31
31
@@ -119,6 +119,14 @@ Once loaded into PowerShell, you can run a command like this:
119
119
120
120
Get-Service | Sort-Object Status | Format-Wide -view Status
This is an example of creating a formatting file from an empty object. Normally you would first define your object and verify it has all the properties you need and then you would create the formatting file. But you may want to create the formatting file in parallel using a technique like this.
Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object.
183
+
Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object. Ideally, the object will have values for all properties.
Shows the specified path as a graphical tree in the console. This is intended as PowerShell alternative to the tree DOS command. This function should work for any type of PowerShell provider and can be used to explore providers used for configuration like the WSMan provider or the registry. Currently, this will not work with any PSDrives created with the Certificate provider.
32
+
Shows the specified path as a graphical tree in the console. This is intended as PowerShell alternative to the tree DOS command. This function should work for any type of PowerShell provider and can be used to explore providers used for configuration like the WSMan provider or the registry. Currently, this will *not work* with any PSDrives created with the Certificate provider. It should work cross-platform.
33
33
34
34
By default, the output will only show directory or equivalent structures. But you can opt to include items well as item details by using the ShowProperty parameter. Specify a comma separated list of properties or use * to view them all.
35
35
36
-
It should work cross-platform. If you are running PowerShell 7, there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. The color scheme is designed for the file system. This parameter has an alias of -ansi.
36
+
If the Path is a FileSystem path there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. This parameter has an alias of -ansi.
37
37
38
38
Note: This is an update to an older function in my library. I seem to recall I found the original code somewhere online, perhaps from someone like Lee Holmes. Sadly, I neglected to record the source.
39
39
@@ -125,7 +125,7 @@ Shows all the containers and items in the WSMan: drive.
Use * to display all properties otherwise specify a comma separated list.
241
+
Shows the properties on containers and items. Use * to display all properties otherwise specify a comma separated list.
243
242
244
243
```yaml
245
244
Type: String[]
@@ -253,6 +252,22 @@ Accept pipeline input: False
253
252
Accept wildcard characters: False
254
253
```
255
254
255
+
### -InColor
256
+
257
+
Show tree and item colorized. Values are from the $PSAnsiMap variable.
258
+
259
+
```yaml
260
+
Type: SwitchParameter
261
+
Parameter Sets: (All)
262
+
Aliases: ansi
263
+
264
+
Required: False
265
+
Position: Named
266
+
Default value: None
267
+
Accept pipeline input: False
268
+
Accept wildcard characters: False
269
+
```
270
+
256
271
### CommonParameters
257
272
258
273
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
@@ -267,8 +282,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
267
282
268
283
## NOTES
269
284
270
-
If you are using PowerShell 7, you can use the InColor parameter, or its alias ansi, to display the tree in a color code format.
271
-
272
285
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
<maml:para>When defining custom objects with a new typename, PowerShell by default will display all properties. However, you may wish to have a specific default view, be it a table or list. Or you may want to have different views display the object differently. Format directives are stored in format.ps1xml files which can be tedious to create. This command simplifies that process.</maml:para>
8175
-
<maml:para>Pipe an instance of your custom object to this function and it will generate a format.ps1xml file based on either all the properties or a subset that you provide. When creating the file make sure the object you are modeling with does not have empty property values. You can repeat the process to add additional views. When finished, edit the format.ps1xml file and fine tune it. The file will have notes on how to substitute script blocks. If you run this command inside the Visual Studio Code PowerShell Integrated Console and use -Passthru, the new file will automatically be opened in your editor.</maml:para>
8176
-
<maml:para>Note that table views are set to Autosize. But the table definition will include best guesses for column widths. If you prefer a more granular approach you can delete the Autosize tag and experiment with varying widths. Don't forget to run Update-FormatData to load your new file. You may need to start a new PowerShell session to test changes.</maml:para>
8175
+
<maml:para>Pipe an instance of your custom object to this function and it will generate a format.ps1xml file based on either all the properties or a subset that you provide. You can repeat the process to add additional views. When finished, edit the format.ps1xml file and fine tune it. The file will have notes on how to substitute script blocks. If you run this command inside the Visual Studio Code PowerShell Integrated Console and use -Passthru, the new file will automatically be opened in your editor.</maml:para>
8176
+
<maml:para>Note that table views are set to Autosize. But the table definition will include best guesses for column widths. If you prefer a more granular approach you can delete the Autosize tag and experiment with varying widths. Don't forget to run Update-FormatData to load your new file. You may need to start a new PowerShell session to fully test changes.</maml:para>
<maml:para>Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object.</maml:para>
8184
+
<maml:para>Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object. Ideally, the object will have values for all properties.</maml:para>
<maml:para>Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object.</maml:para>
8367
+
<maml:para>Specify an object to analyze and generate or update a ps1xml file. All you need is one instance of the object. Ideally, the object will have values for all properties.</maml:para>
<maml:para>This is an example of creating a formatting file from an empty object. Normally you would first define your object and verify it has all the properties you need and then you would create the formatting file. But you may want to create the formatting file in parallel using a technique like this.</maml:para>
8594
+
</dev:remarks>
8595
+
</command:example>
8589
8596
</command:examples>
8590
8597
<command:relatedLinks>
8591
8598
<maml:navigationLink>
@@ -11802,9 +11809,9 @@ Mode LastWriteTime Length Name
11802
11809
</maml:description>
11803
11810
</command:details>
11804
11811
<maml:description>
11805
-
<maml:para>Shows the specified path as a graphical tree in the console. This is intended as PowerShell alternative to the tree DOS command. This function should work for any type of PowerShell provider and can be used to explore providers used for configuration like the WSMan provider or the registry. Currently, this will not work with any PSDrives created with the Certificate provider.</maml:para>
11812
+
<maml:para>Shows the specified path as a graphical tree in the console. This is intended as PowerShell alternative to the tree DOS command. This function should work for any type of PowerShell provider and can be used to explore providers used for configuration like the WSMan provider or the registry. Currently, this will not work with any PSDrives created with the Certificate provider. It should work cross-platform.</maml:para>
11806
11813
<maml:para>By default, the output will only show directory or equivalent structures. But you can opt to include items well as item details by using the ShowProperty parameter. Specify a comma separated list of properties or use * to view them all.</maml:para>
11807
-
<maml:para>It should work cross-platform. If you are running PowerShell 7, there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. The color scheme is designed for the file system. This parameter has an alias of -ansi.</maml:para>
11814
+
<maml:para>If the Path is a FileSystem path there is a dynamic parameter, -InColor, that will write ANSI-colored output to the pipeline. This parameter has an alias of -ansi.</maml:para>
11808
11815
<maml:para>Note: This is an update to an older function in my library. I seem to recall I found the original code somewhere online, perhaps from someone like Lee Holmes. Sadly, I neglected to record the source.</maml:para>
11809
11816
</maml:description>
11810
11817
<command:syntax>
@@ -11869,6 +11876,17 @@ Mode LastWriteTime Length Name
@@ -12029,7 +12070,6 @@ Mode LastWriteTime Length Name
12029
12070
</command:returnValues>
12030
12071
<maml:alertSet>
12031
12072
<maml:alert>
12032
-
<maml:para>If you are using PowerShell 7, you can use the InColor parameter, or its alias ansi, to display the tree in a color code format.</maml:para>
12033
12073
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/</maml:para>
12034
12074
</maml:alert>
12035
12075
</maml:alertSet>
@@ -12116,7 +12156,7 @@ WSMan:\
12116
12156
</command:example>
12117
12157
<command:example>
12118
12158
<maml:title>-------------------------- Example 4 --------------------------</maml:title>
<maml:para>Show a tree listing with files including a few user specified properties. This example is using parameter and command aliases.</maml:para>
12185
+
<maml:para>Show a tree listing with files including a few user specified properties in color. This example is using parameter and command aliases.</maml:para>
0 commit comments