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: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
# CHANGELOG
2
2
3
+
-__02/26/2025__
4
+
- Introduced the `RegistryStyle` class and added a `Registry` property to the `TreeStyle` class.
5
+
- Moved file system style properties from `TreeStyle` to a new `FileSystemStyle` class, with a `FileSystem` property added to `TreeStyle`.
6
+
- Added coloring support for `Get-PSTreeRegistry`, allowing customization based on the `Kind` property of `TreeRegistryBase` instances.
7
+
3
8
-__02/22/2025__
4
9
- Renamed base types by removing the leading `PS` prefix (e.g., `PSTreeFile` → `TreeFile`, `PSTreeRegistryKey` → `TreeRegistryKey`) to streamline naming and improve consistency.
5
10
- Added the `Get-PSTreeRegistry` cmdlet, enabling tree-style traversal of the Windows Registry. This Windows-only cmdlet supports parameters like `-Path`, `-LiteralPath`, `-Depth`, `-Force`, and `-KeysOnly` for filtering and controlling output depth. Includes comprehensive Pester tests and documentation updates.
Gets the instance of `TreeStyle` used for output rendering.
12
+
Retrieves the `TreeStyle` instance used for output rendering.
13
13
14
14
## SYNTAX
15
15
@@ -20,7 +20,9 @@ Get-PSTreeStyle
20
20
21
21
## DESCRIPTION
22
22
23
-
The `Get-PSTreeStyle` cmdlet can be used to access the instance of `TreeStyle` used for rendering and customizing the `Get-PSTree` output. See [__about_TreeStyle__](./about_TreeStyle.md) for more information.
23
+
The `Get-PSTreeStyle` cmdlet provides access to the `TreeStyle` instance that controls the rendering and customization of output for the `Get-PSTree` and `Get-PSTreeRegistry` cmdlets.
24
+
25
+
For details, see [__about_TreeStyle__](./about_TreeStyle.md).
24
26
25
27
## EXAMPLES
26
28
@@ -30,6 +32,8 @@ The `Get-PSTreeStyle` cmdlet can be used to access the instance of `TreeStyle` u
30
32
PS ..\PSTree> $style = Get-PSTreeStyle
31
33
```
32
34
35
+
Stores the `TreeStyle` instance in the `$style` variable.
Describes the available support for ANSI escape sequences in PSTree Module.
9
+
The `TreeStyle` class enables customization of the hierarchical output for `Get-PSTree` and `Get-PSTreeRegistry` cmdlets in the PSTree module.
6
10
7
11
## LONG DESCRIPTION
8
12
9
-
PSTree v2.2.0 adds support for coloring the hierarchy output from `Get-PSTree` cmdlet via the `TreeStyle` type. The type offers a subset of capabilities that the built-in [`PSStyle`][1] has, more specifically, the [`FileInfoFormatting`][2] subset.
10
-
11
-
The instance of this type can be accessed via the [`Get-PSTreeStyle`][3] cmdlet or the `[PSTree.Style.TreeStyle]::Instance` property:
13
+
PSTree version 2.2.0 and later introduces support for coloring the hierarchical output of the `Get-PSTree` and `Get-PSTreeRegistry` cmdlets using the `TreeStyle` class. This class provides a subset of features similar to those in PowerShell’s built-in [PSStyle][1].
14
+
You can access the singleton instance of `TreeStyle` through either the [Get-PSTreeStyle][2] cmdlet or the `[PSTree.Style.TreeStyle]::Instance` property:
It has some useful methods to combine escape sequences as well as add accents, see next section for more details.
21
+
The `TreeStyle` class offers methods for combining escape sequences and applying text accents, such as bold or italic. See the next section for additional details.
The `EscapeSequence()` method can be used to see the escape sequence used to produce the color and accent, for example:
46
+
The `.EscapeSequence()` method reveals the escape sequence applied to generate specific colors or accents. For example:
43
47
44
48
<div>
45
49
@@ -48,56 +52,101 @@ The `EscapeSequence()` method can be used to see the escape sequence used to pro
48
52
49
53
## CUSTOMIZING OUTPUT
50
54
51
-
Similar to `PSStyle` you can update the properties of `TreeStyle` as well as add an remove coloring for different extensions.
55
+
### Get-PSTree
56
+
57
+
You can customize the output of [`Get-PSTree`][5] by modifying the properties of the `TreeStyle` class, much like you would with PowerShell’s `PSStyle`. This allows you to update colors for directories, files, and specific file extensions, as well as add or remove color schemes for different file types.
52
58
53
59
> [!NOTE]
54
60
>
55
-
> -For now, customizing the output of files that are a __SymbolicLink__ is not supported.
56
-
> - The __Executable__ accent is only available for Windows Operating System.
61
+
> -Customizing the output for files that are __Symbolic Links__ is not currently supported.
62
+
> - The __Executable__ accent is only available on Windows operating systems.
# Update the Directory style to use a magenta background
84
+
$style.FileSystem.Directory = "`e[45m"
76
85
```
77
86
78
87
> [!TIP]
79
88
>
80
-
> - The `` `e `` escape character was added in PowerShell 6. __Windows PowerShell 5.1__ users can use `[char] 27` instead, for example from previous example, instead of ``"`e[45m"`` you can use `"$([char] 27)[45m"`.
81
-
See [__about_Special_Characters__][4] for more details.
82
-
> - The `TreeStyle` type has 3 public methods that you can use to add accents or combine VT sequences, `ToItalic()`, `ToBold()` and `CombineSequence()`.
83
-
> - You can also reset the style instance to its initial state using `.ResetSettings()` however if you had the instance stored in a variable you will need to re-assign its value, i.e.: `$style.ResetSettings()` then `$style = treestyle`.
89
+
> - PowerShell 6 and later support the `` `e `` escape character for VT sequences. For __Windows PowerShell 5.1__, use `[char] 27` instead. For example, replace ``"`e[45m"`` with `"$([char] 27)[45m"`. See [about_Special_Characters][3] for more details.
90
+
> - The `TreeStyle` class provides methods like `.ToItalic()`, `.ToBold()`, and `.CombineSequence()` to apply text accents or combine VT sequences.
91
+
> - To reset the `TreeStyle` instance to its default state, use `.ResetSettings()`. If stored in a variable, reassign it afterward, e.g., `$style.ResetSettings()` followed by `$style = Get-PSTreeStyle`.
92
+
93
+
After applying these changes, re-running the same `Get-PSTree` command will display the updated styles:
Starting with PSTree version 2.2.3, the [`Get-PSTreeRegistry`][6] cmdlet supports customizable coloring via the `PSTree.Style.RegistryStyle` object. This allows you to define colors for both `TreeRegistryKey` and `TreeRegistryValue` instances.
103
+
104
+
-__TreeRegistryKey__: The color is set using the `.RegistryKey` property.
105
+
-__TreeRegistryValue__: The color is controlled by the `.RegistryValueKind` property, a dictionary that maps [RegistryValueKind][4] types to color settings based on the `.Kind` property of each registry value.
84
106
85
-
Then, if we re-run the same command we can see those changes in the PSTree output:
107
+
> [!NOTE]
108
+
> Keys in `.RegistryValueKind` must be of type [RegistryValueKind][4] or convertible to it. For example, both ``.RegistryValueKind[2] = "`e[45m"`` (where `2` corresponds to `ExpandString` Enum value) and ``.RegistryValueKind['ExpandString'] = "`e[45m"`` are valid. Similarly, ``.RegistryValueKind[1] = "`e[45m"`` or ``.RegistryValueKind['String'] = "`e[45m"`` can be used for `String`. String keys must match the enum names exactly, such as `'String'`, `'ExpandString'`, `'Binary'`, etc.
109
+
110
+
Here’s the standard output of `Get-PSTreeRegistry` before customization:
Similarly to `PSStyle`, you can disable the ANSI rendering by updating the `OutputRendering` property:
139
+
Just like PowerShell’s `PSStyle`, you can disable ANSI rendering in PSTree’s output by modifying the `.OutputRendering` property of the `TreeStyle` instance. Simply set it to `'PlainText'` using the following command:
95
140
96
141
```powershell
97
142
(Get-PSTreeStyle).OutputRendering = 'PlainText'
98
143
```
99
144
145
+
This disables all ANSI-based coloring and formatting, resulting in plain text output for commands like `Get-PSTree` and `Get-PSTreeRegistry`. It’s a straightforward way to simplify the display when you don’t need the extra visual styling.
0 commit comments