Skip to content

Commit de6891a

Browse files
v2.42.0
1 parent e45ae72 commit de6891a

15 files changed

+180
-94
lines changed

Archive-ChangeLog.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@
22

33
This file contains older change history. It is maintained for reference purposes.
44

5+
## v2.39.0
6+
7+
+ Updated `Test-WithCulture` to include additional Verbose output.
8+
+ Added command [Get-FileExtensionInfo](docs/Get-FileExtensionInfo.md) with format file `FileExtensionInfo.format.ps1xml'. This command will require PowerShell 7.
9+
+ Added `New-PSDynamicParameter` and `New-PSDynamicParameterForm`.
10+
+ Incorporated pull request [#116](https://github.com/jdhitsolutions/PSScriptTools/pull/116) to fix bug with `Get-ParameterInfo` when the command has a `count` parameter. Thanks @ninmonkey.
11+
+ Added command [Get-LastModifiedFile](docs/Get-LastModifiedFile.md) and its alias *glm*.
12+
+ Help updates.
13+
+ Updated `README.md`.
14+
15+
## v2.38.0
16+
17+
+ Added `Get-PSUnique` function with an alias of `gpsu`. ([Issue #109](https://github.com/jdhitsolutions/PSScriptTools/issues/109)).
18+
+ Modified `Show-AnsiSequence` to default to `Foreground` when using `-Type` ([Issue #110](https://github.com/jdhitsolutions/PSScriptTools/issues/110)).
19+
+ Cleaned up module manifest.
20+
+ Updated `New-PSFormatXML` to __not__ create the ps1xml file if a bad property is detected ([Issue #111](https://github.com/jdhitsolutions/PSScriptTools/issues/111)).
21+
+ Modified `New-PSFormatXML` to __not__ add an explicit declaration. This means the files will now be saved in the correct UTF-8 format and not UTF-8 with BOM.
22+
+ Modified TODO VSCode command to put date at the end. Otherwise, it breaks the `Better Comments` extension.
23+
+ Added `Set-LocationToFile` which is only loaded when importing the module in VS Code or the PowerShell ISE.
24+
+ Re-saved all `.ps1xml` files as `UTF-8`.
25+
+ Added custom type extension files `fileinfo.types.ps1xml` and `system.diagnostics.process.types.ps1xml`.
26+
+ Updated `README.md`.
27+
28+
## v2.37.0
29+
30+
+ Updated `Convertto-WPFGrid` to better handle non-standard property names. ([Issue #108](https://github.com/jdhitsolutions/PSScriptTools/issues/108)).
31+
+ Modified custom format files that use ANSI to test if host name matches 'console' or 'code' to support VSCode.
32+
+ Modified `Summary` view in `psparameterinfo.format.ps1xml` to not use autosizing.
33+
+ Added `<AutoSize/>` back to `serviceansi.format.ps1xml` so that ANSI output displays properly.
34+
+ Modified `Show-ANSI` and `Get-PSAnsiFileMap` to use `[char]27` instead of `[char]0x1b` for Windows PowerShell sessions.
35+
+ Modified ANSI sequences in format files to use `[char]27`. ([Issue #107](https://github.com/jdhitsolutions/PSScriptTools/issues/107)).
36+
+ Modified ANSI sequences in format files recognize a remote PSSession. ([Issue #106](https://github.com/jdhitsolutions/PSScriptTools/issues/106)).
37+
+ Update `Get-PSLocation` to work in a PowerShell remoting session where there is no profile. ([Issue #104](https://github.com/jdhitsolutions/PSScriptTools/issues/104)).
38+
+ Updated help.
39+
+ Updated `README.md`.
40+
41+
542
## v2.36.0
643

744
+ Update `Get-MyVariable` to make it more compatible with PowerShell 7 ([Issue #103](https://github.com/jdhitsolutions/PSScriptTools/issues/103)). This also makes the command now compatible with the PowerShell ISE.

PSScriptTools.psd1

84 Bytes
Binary file not shown.

PSScriptToolsManual.pdf

54.9 KB
Binary file not shown.

README.md

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,53 +1641,12 @@ C:\work\Alpha\
16411641

16421642
This example is using parameter and command aliases. You can display a tree listing with files including user-specified properties. Use a value of * to show all properties.
16431643

1644-
### [New-ANSIBar](docs/New-ANSIBar.md)
1645-
1646-
You can use this command to create colorful bars using ANSI escape sequences based on a 256 color scheme. The default behavior is to create a gradient bar that goes from first to last values in the range and then back down again. Or you can create a single gradient that runs from the beginning of the range to the end. You can use one of the default characters or specify a custom one.
1647-
1648-
![New-ANSIBar](images/ansibar.png)
1649-
16501644
### [New-RedGreenGradient](docs/New-RedGreenGradient.md)
16511645

1652-
A related command is `New-RedGreenGradient`, which displays a bar going from red to green. This might be handy when you want to present a visual indicator.
1646+
`New-RedGreenGradient`, which displays a bar going from red to green. This might be handy when you want to present a visual indicator.
16531647

16541648
![New-RedGreenGradient](images/redgreen.png)
16551649

1656-
### [Write-ANSIProgress](docs/Write-ANSIProgress.md)
1657-
1658-
You could also use `Write-ANSIProgress` to show a custom ANSI bar.
1659-
1660-
![Write-ANSIProgress simple](images/write-ansprogress-1.png)
1661-
1662-
![write-ANSIProgress in code](images/write-ansprogress-2.png)
1663-
1664-
Or you can use it in your code to display a console progress bar.
1665-
1666-
```powershell
1667-
$sb = {
1668-
Clear-Host
1669-
$top = Get-ChildItem c:\scripts -Directory
1670-
$i = 0
1671-
$out=@()
1672-
$pos = $host.ui.RawUI.CursorPosition
1673-
Foreach ($item in $top) {
1674-
$i++
1675-
$pct = [math]::round($i/$top.count,2)
1676-
Write-ANSIProgress -PercentComplete $pct -position $pos
1677-
Write-Host " Processing $(($item.fullname).padright(80))"
1678-
-ForegroundColor Yellow -NoNewline
1679-
$out+= Get-ChildItem -path $item -Recurse -file |
1680-
Measure-Object -property length -sum |
1681-
Select-Object @{Name="Path";Expression={$item.fullname}},Count,
1682-
@{Name="Size";Expression={$_.Sum}}
1683-
}
1684-
Write-Host ""
1685-
$out | Sort-Object -property Size -Descending
1686-
}
1687-
```
1688-
1689-
![Write-ANSIProgress script](images/write-ansprogress-3.png)
1690-
16911650
## Format Functions
16921651

16931652
The module contains a set of simple commands to make it easier to format values.
@@ -2431,6 +2390,66 @@ To use the resulting value you still need to construct an ANSI string with the e
24312390

24322391
In PowerShell 7 you can use `` `e ``. Or `$([char]27)` which works in all PowerShell versions.
24332392

2393+
### [New-ANSIBar](docs/New-ANSIBar.md)
2394+
2395+
You can use this command to create colorful bars using ANSI escape sequences based on a 256 color scheme. The default behavior is to create a gradient bar that goes from first to last values in the range and then back down again. Or you can create a single gradient that runs from the beginning of the range to the end. You can use one of the default characters or specify a custom one.
2396+
2397+
![New-ANSIBar](images/ansibar.png)
2398+
2399+
### [Write-ANSIProgress](docs/Write-ANSIProgress.md)
2400+
2401+
You could also use `Write-ANSIProgress` to show a custom ANSI bar.
2402+
2403+
![Write-ANSIProgress simple](images/write-ansprogress-1.png)
2404+
2405+
![write-ANSIProgress in code](images/write-ansprogress-2.png)
2406+
2407+
Or you can use it in your code to display a console progress bar.
2408+
2409+
```powershell
2410+
$sb = {
2411+
Clear-Host
2412+
$top = Get-ChildItem c:\scripts -Directory
2413+
$i = 0
2414+
$out=@()
2415+
$pos = $host.ui.RawUI.CursorPosition
2416+
Foreach ($item in $top) {
2417+
$i++
2418+
$pct = [math]::round($i/$top.count,2)
2419+
Write-ANSIProgress -PercentComplete $pct -position $pos
2420+
Write-Host " Processing $(($item.fullname).padright(80))"
2421+
-ForegroundColor Yellow -NoNewline
2422+
$out+= Get-ChildItem -path $item -Recurse -file |
2423+
Measure-Object -property length -sum |
2424+
Select-Object @{Name="Path";Expression={$item.fullname}},Count,
2425+
@{Name="Size";Expression={$_.Sum}}
2426+
}
2427+
Write-Host ""
2428+
$out | Sort-Object -property Size -Descending
2429+
}
2430+
```
2431+
2432+
![Write-ANSIProgress script](images/write-ansprogress-3.png)
2433+
2434+
2435+
### [Show-ANSISequence](docs/Show-ANSISequence.md)
2436+
2437+
You can use `Show-ANSISequence` to preview how it will look in your PowerShell session. You might get a difference appearance in Windows Terminal depending on the color scheme you are using.
2438+
2439+
The default behavior is to show basic sequences.
2440+
2441+
![show basic ansi sequence](images/show-ansi-basic.png)
2442+
2443+
You can also view foreground and or background settings.
2444+
2445+
![show ansi foreground](images/show-ansi-foreground.png)
2446+
2447+
You can even use an RGB value.
2448+
2449+
![show ansi rgb sequence](images/show-ansi-rgb.png)
2450+
2451+
The escape character will match what is acceptable in your version of PowerShell. These screen shots are showing PowerShell 7.
2452+
24342453
## Other Module Features
24352454

24362455
From time to time, I will include additional items that you might find useful in your PowerShell work.

changelog.md

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
This file contains the most recent change history for the PSScriptTools module.
44

5+
## v2.42.0
6+
7+
+ Updated module manifest to load required .NET assembly for `Convert-HTMLtoAnsi`. [Issue #124](https://github.com/jdhitsolutions/PSScriptTools/issues/124)
8+
+ Updated `Show-AnsiSequence` to fix a display bug that was dropping values. [Issue #125](https://github.com/jdhitsolutions/PSScriptTools/issues/125)
9+
+ Updated missing online help links.
10+
+ Added new sample script `today.ps1`.
11+
+ Help updates.
12+
+ Updated `README.md`.
13+
514
## v2.41.0
615

716
+ Added function `Copy-CommandHistory` with an alias of `ch`.
@@ -21,42 +30,6 @@ This file contains the most recent change history for the PSScriptTools module.
2130
+ Modified `Convertto-Markdown` to add a `AsList` parameter. [Issue #114](https://github.com/jdhitsolutions/PSScriptTools/issues/114)
2231
+ Updated `README.md`.
2332

24-
## v2.39.0
25-
26-
+ Updated `Test-WithCulture` to include additional Verbose output.
27-
+ Added command [Get-FileExtensionInfo](docs/Get-FileExtensionInfo.md) with format file `FileExtensionInfo.format.ps1xml'. This command will require PowerShell 7.
28-
+ Added `New-PSDynamicParameter` and `New-PSDynamicParameterForm`.
29-
+ Incorporated pull request [#116](https://github.com/jdhitsolutions/PSScriptTools/pull/116) to fix bug with `Get-ParameterInfo` when the command has a `count` parameter. Thanks @ninmonkey.
30-
+ Added command [Get-LastModifiedFile](docs/Get-LastModifiedFile.md) and its alias *glm*.
31-
+ Help updates.
32-
+ Updated `README.md`.
33-
34-
## v2.38.0
35-
36-
+ Added `Get-PSUnique` function with an alias of `gpsu`. ([Issue #109](https://github.com/jdhitsolutions/PSScriptTools/issues/109)).
37-
+ Modified `Show-AnsiSequence` to default to `Foreground` when using `-Type` ([Issue #110](https://github.com/jdhitsolutions/PSScriptTools/issues/110)).
38-
+ Cleaned up module manifest.
39-
+ Updated `New-PSFormatXML` to __not__ create the ps1xml file if a bad property is detected ([Issue #111](https://github.com/jdhitsolutions/PSScriptTools/issues/111)).
40-
+ Modified `New-PSFormatXML` to __not__ add an explicit declaration. This means the files will now be saved in the correct UTF-8 format and not UTF-8 with BOM.
41-
+ Modified TODO VSCode command to put date at the end. Otherwise, it breaks the `Better Comments` extension.
42-
+ Added `Set-LocationToFile` which is only loaded when importing the module in VS Code or the PowerShell ISE.
43-
+ Re-saved all `.ps1xml` files as `UTF-8`.
44-
+ Added custom type extension files `fileinfo.types.ps1xml` and `system.diagnostics.process.types.ps1xml`.
45-
+ Updated `README.md`.
46-
47-
## v2.37.0
48-
49-
+ Updated `Convertto-WPFGrid` to better handle non-standard property names. ([Issue #108](https://github.com/jdhitsolutions/PSScriptTools/issues/108)).
50-
+ Modified custom format files that use ANSI to test if host name matches 'console' or 'code' to support VSCode.
51-
+ Modified `Summary` view in `psparameterinfo.format.ps1xml` to not use autosizing.
52-
+ Added `<AutoSize/>` back to `serviceansi.format.ps1xml` so that ANSI output displays properly.
53-
+ Modified `Show-ANSI` and `Get-PSAnsiFileMap` to use `[char]27` instead of `[char]0x1b` for Windows PowerShell sessions.
54-
+ Modified ANSI sequences in format files to use `[char]27`. ([Issue #107](https://github.com/jdhitsolutions/PSScriptTools/issues/107)).
55-
+ Modified ANSI sequences in format files recognize a remote PSSession. ([Issue #106](https://github.com/jdhitsolutions/PSScriptTools/issues/106)).
56-
+ Update `Get-PSLocation` to work in a PowerShell remoting session where there is no profile. ([Issue #104](https://github.com/jdhitsolutions/PSScriptTools/issues/104)).
57-
+ Updated help.
58-
+ Updated `README.md`.
59-
6033
## Archive
6134

6235
If you need to see older change history, look at the [Archive ChangeLog](https://github.com/jdhitsolutions/PSScriptTools/blob/master/Archive-ChangeLog.md) online.

docs/Copy-HistoryCommand.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSScriptTools-help.xml
33
Module Name: PSScriptTools
4-
online version:
4+
online version: https://bit.ly/3nPKjwX
55
schema: 2.0.0
66
---
77

docs/New-ANSIBar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
160160
[New-RedGreenGradient](New-RedGreenGradient.md)
161161
162162
[Write-ANSIProgress](Write-ANSIProgress.md)
163+
164+
[Show-ANSISequence](Show-ANSISequence.md)

docs/Show-ANSISequence.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSScriptTools-help.xml
33
Module Name: PSScriptTools
4-
online version: https://en.wikipedia.org/wiki/ANSI_escape_code
4+
online version: https://bit.ly/3Ix5s77
55
schema: 2.0.0
66
---
77

@@ -63,7 +63,7 @@ The output will be formatted using the corresponding ANSI escape sequence as see
6363
### EXAMPLE 2
6464

6565
```powershell
66-
PS C:\>Show-ANSISequence -Foreground -Type Simple
66+
PS C:\> Show-ANSISequence -Foreground -Type simple
6767
6868
**************
6969
* Foreground *
@@ -73,6 +73,7 @@ PS C:\>Show-ANSISequence -Foreground -Type Simple
7373
`e[34mHello`e[0m `e[35mHello`e[0m `e[36mHello`e[0m
7474
`e[90mHello`e[0m `e[91mHello`e[0m `e[92mHello`e[0m
7575
`e[94mHello`e[0m `e[95mHello`e[0m `e[96mHello`e[0m
76+
7677
```
7778

7879
### EXAMPLE 3
@@ -91,7 +92,7 @@ Show an RGB ANSI sequence. The output will be formatted using the sequence.
9192
PS C:\> Show-ANSISequence -RGB 225,100,50 -AsString | Set-Clipboard
9293
```
9394

94-
Repeat the previous example but write the output as a plain string and copy it to the Windows clipboard.
95+
Repeat the previous example but write the output as a plain string and copy it to the clipboard.
9596

9697
## PARAMETERS
9798

@@ -205,6 +206,14 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
205206
206207
### System.String
207208
209+
## Notes
210+
211+
Learn more about ANSI sequences at https://en.wikipedia.org/wiki/ANSI_escape_code
212+
213+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
214+
208215
## RELATED LINKS
209216
210-
[https://en.wikipedia.org/wiki/ANSI_escape_code](https://en.wikipedia.org/wiki/ANSI_escape_code)
217+
[Write-ANSIProgress](Write-ANSIProgress.md)
218+
219+
[New-ANSIBar](New-ANSIBar.md)

docs/Write-ANSIProgress.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ PS C:\> $sb = {
8888
@{Name="Size";Expression={$_.Sum}}
8989
}
9090
Write-Host ""
91-
$out | Sort-object -property Size -Descending
91+
$out | Sort-Object -property Size -Descending
9292
}
9393
PS C:\> Invoke-Command -scriptblock $sb
9494
```
@@ -185,3 +185,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
185185
[New-ANSIBar](New-ANSIBar.md)
186186
187187
[New-RedGreenGradient](New-RedGreenGradient.md)
188+
189+
[Show-ANSISequence](Show-ANSISequence.md)

en-us/PSScriptTools-help.xml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4162,6 +4162,10 @@ Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id SI ProcessName
41624162
</command:example>
41634163
</command:examples>
41644164
<command:relatedLinks>
4165+
<maml:navigationLink>
4166+
<maml:linkText>Online Version:</maml:linkText>
4167+
<maml:uri>https://bit.ly/3nPKjwX</maml:uri>
4168+
</maml:navigationLink>
41654169
<maml:navigationLink>
41664170
<maml:linkText>Get-History</maml:linkText>
41674171
<maml:uri></maml:uri>
@@ -10836,6 +10840,10 @@ Count 3</dev:code>
1083610840
<maml:linkText>Write-ANSIProgress</maml:linkText>
1083710841
<maml:uri></maml:uri>
1083810842
</maml:navigationLink>
10843+
<maml:navigationLink>
10844+
<maml:linkText>Show-ANSISequence</maml:linkText>
10845+
<maml:uri></maml:uri>
10846+
</maml:navigationLink>
1083910847
</command:relatedLinks>
1084010848
</command:command>
1084110849
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
@@ -17458,7 +17466,10 @@ PS C:\Scripts\Foo\&gt;</dev:code>
1745817466
</command:returnValue>
1745917467
</command:returnValues>
1746017468
<maml:alertSet>
17461-
<maml:alert />
17469+
<maml:alert>
17470+
<maml:para>Learn more about ANSI sequences at https://en.wikipedia.org/wiki/ANSI_escape_code</maml:para>
17471+
<maml:para>Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/</maml:para>
17472+
</maml:alert>
1746217473
</maml:alertSet>
1746317474
<command:examples>
1746417475
<command:example>
@@ -17482,7 +17493,7 @@ PS C:\Scripts\Foo\&gt;</dev:code>
1748217493
</command:example>
1748317494
<command:example>
1748417495
<maml:title>-------------------------- EXAMPLE 2 --------------------------</maml:title>
17485-
<dev:code>PS C:\&gt;Show-ANSISequence -Foreground -Type Simple
17496+
<dev:code>PS C:\&gt; Show-ANSISequence -Foreground -Type simple
1748617497

1748717498
**************
1748817499
* Foreground *
@@ -17509,14 +17520,22 @@ PS C:\Scripts\Foo\&gt;</dev:code>
1750917520
<maml:title>-------------------------- EXAMPLE 4 --------------------------</maml:title>
1751017521
<dev:code>PS C:\&gt; Show-ANSISequence -RGB 225,100,50 -AsString | Set-Clipboard</dev:code>
1751117522
<dev:remarks>
17512-
<maml:para>Repeat the previous example but write the output as a plain string and copy it to the Windows clipboard.</maml:para>
17523+
<maml:para>Repeat the previous example but write the output as a plain string and copy it to the clipboard.</maml:para>
1751317524
</dev:remarks>
1751417525
</command:example>
1751517526
</command:examples>
1751617527
<command:relatedLinks>
1751717528
<maml:navigationLink>
17518-
<maml:linkText>https://en.wikipedia.org/wiki/ANSI_escape_code</maml:linkText>
17519-
<maml:uri>https://en.wikipedia.org/wiki/ANSI_escape_code</maml:uri>
17529+
<maml:linkText>Online Version:</maml:linkText>
17530+
<maml:uri>https://bit.ly/3Ix5s77</maml:uri>
17531+
</maml:navigationLink>
17532+
<maml:navigationLink>
17533+
<maml:linkText>Write-ANSIProgress</maml:linkText>
17534+
<maml:uri></maml:uri>
17535+
</maml:navigationLink>
17536+
<maml:navigationLink>
17537+
<maml:linkText>New-ANSIBar</maml:linkText>
17538+
<maml:uri></maml:uri>
1752017539
</maml:navigationLink>
1752117540
</command:relatedLinks>
1752217541
</command:command>
@@ -19408,7 +19427,7 @@ BOVINE320 32 12 37.87% ■■■■■■■■■■■■■
1940819427
@{Name="Size";Expression={$_.Sum}}
1940919428
}
1941019429
Write-Host ""
19411-
$out | Sort-object -property Size -Descending
19430+
$out | Sort-Object -property Size -Descending
1941219431
}
1941319432
PS C:\&gt; Invoke-Command -scriptblock $sb</dev:code>
1941419433
<dev:remarks>
@@ -19429,6 +19448,10 @@ PS C:\&gt; Invoke-Command -scriptblock $sb</dev:code>
1942919448
<maml:linkText>New-RedGreenGradient</maml:linkText>
1943019449
<maml:uri></maml:uri>
1943119450
</maml:navigationLink>
19451+
<maml:navigationLink>
19452+
<maml:linkText>Show-ANSISequence</maml:linkText>
19453+
<maml:uri></maml:uri>
19454+
</maml:navigationLink>
1943219455
</command:relatedLinks>
1943319456
</command:command>
1943419457
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">

0 commit comments

Comments
 (0)