Skip to content

Commit efb8ae0

Browse files
v2.32.0
1 parent c380019 commit efb8ae0

35 files changed

+1771
-166
lines changed

Archive-ChangeLog.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,143 @@
11
# Archived ChangeLog for PSScriptTools
22

3+
This file contains older change history. It is maintained for reference purposes.
4+
5+
## v2.29.0
6+
7+
+ Modified `Get-WindowsVersion` to not use remoting when connecting to the local computer. (Issue #90)
8+
+ Updated help documentation for `Get-WindowsVersion` and `Get-WindowsVersionString`.
9+
+ Added command `Copy-PSFunction` with an alias of `cpfun`.
10+
11+
## v2.28.0
12+
13+
+ Added `Compare-Script` thanks to @cohdjn.
14+
+ Added `Get-PSProfile` and a related formatting file, `psprofilepath.format.ps1xml`.
15+
+ Updated `README.md`.
16+
17+
## v2.27.0
18+
19+
+ Added a new command called `Get-MyAlias` with an alias of `gma`.
20+
+ Added a custom formatting file for alias objects with new views of `Options` and `Source`.
21+
+ Revised the help PDF to include command help.
22+
+ Help documentation cleanup.
23+
+ Updated `README.md`
24+
+ Fixed bug in `Test-Expression` that was importing the wrong module.
25+
+ Modified `New-PSDriveHere` to not write the new PSDrive object to the pipeline. Added a `-Passthru` parameter. This is a BREAKING change to the command.
26+
+ Modified `Get-ParameterInfo` to write a custom `PSParameterInfo` object to the pipeline and added a default list formatted view.
27+
+ Modified `psscripttool.format.ps1xml` to display Verb in color using ANSI.
28+
29+
## v2.26.2
30+
31+
+ Cleaned up bad links and code fence re-formatting in `README.md`.
32+
+ Created new base version of `PSScriptToolsHelp.md`.
33+
+ Generated a new help manual with a table of contents and nicer formatting. (Issue #87)
34+
+ Renamed help pdf to `PSScriptToolsManual.pdf`.
35+
36+
## v2.26.1
37+
38+
+ Replaced links in `PSScriptToolsHelp` (Issue #86)
39+
+ Updated PDF style when exporting `PSScriptToolsHelp`
40+
+ Removed Table of Contents from `PSScriptToolsHelp.md`. There is a bug when rendering to PDF that doesn't follow the relative links in the document. Hopefully I can add this back in the future.
41+
+ Minor changes to `README.md`.
42+
43+
## v2.26.0
44+
45+
+ Added a Documents type to `PSAnsiFileMap.json`.
46+
+ Added a parameter to `Convert-HashtableToCode` to output an inline string. (Issue #85)
47+
+ Added an alias `chc` for `Convert-HashtableToCode`.
48+
+ Added `Copy-HelpExample` command with an alias of `che`.
49+
+ Added `Open-PSScriptToolsHelp` to open a PDF version of `README.md` as a help manual.
50+
+ Fixed duplicate entry in `PSAnsiFileMap.json`.
51+
+ Revised regex patterns in `PSAnsiFileMap.json`. (Issue #83)
52+
+ Cleaned up code in `filesystem-ansi.format.ps1xml`.
53+
+ Modified `Convert-HashtableToCode` to (hopefully) better handle scriptblocks. (Issue #84)
54+
+ Updated `README.md`
55+
56+
## v2.25.1
57+
58+
+ Fixed incorrect sequence for BlackRectangle in `$PSSpecialChar`. (Issue #82)
59+
+ Fixed incorrect ANSI for System files in `PSAnsiFileMap.json`.
60+
61+
## v2.25.0
62+
63+
+ Added a set of ANSI mappings for temporary files and system files in `psansifilemap.json`.
64+
+ Added additional file extensions to `psansifilemap.json`.
65+
+ Added pointers, section sign, and black rectangle to PSSpecialChars hashtable.
66+
+ Modified `Show-Tree` to make the `InColor` parameter always available. (Issue #80)
67+
+ Modified `Add-Border` to use ANSI escape codes that will work in both Windows PowerShell and PowerShell 7.
68+
+ Updated `New-PSFormatXML` to better handle empty or null property values. (Issue #81)
69+
+ Help Updates
70+
71+
## v2.24.0
72+
73+
+ Added parameter alias of `tb` for `-TextBlock` in `Add-Border`.
74+
+ Added parameter alias of `border` for `-Character` in `Add-Border`.
75+
+ Added `New-ANSIBar` command.
76+
+ Added `New-RedGreenGradient` command.
77+
+ Added `Write-ANSIProgress` command with an alias of `wap`.
78+
+ Defined a global variable called `$PSSpecialChar` which is a hash table select special characters you might want to use with `Add-Border` or `New-AnsiBar`.
79+
+ Added a table view to `modulecommand.format.ps1xml` and made it the default.
80+
+ Added a new table view called `verb` to `modulecommand.format.ps1xml`.
81+
+ Added `Get-PathVariable` with its own custom format file. (Issue #74)
82+
+ Added sample script `Get-Status.ps1`.
83+
+ Added global variable `$PSSamplePath` to point to the sample script location
84+
+ Modified `Add-Border` to adjust line length when ANSI escapes are part of the text. (Issue #79)
85+
+ Modified `Get-PSWho` to trim when using `-AsString`.
86+
+ Fixed bug in `New-PSFormatXML` what was writing an XML element to the pipeline when using `-Wrap`.
87+
+ Updated `Get-ModuleCommand` output to include the module name.
88+
+ Updated `serviceansi.format.ps1xml` and `filesystem-ansi.format.ps1xml` to use an escape sequence available to both Windows PowerShell and PowerShell 7.
89+
+ Fixed wrong type name in `serviceansi.format.ps1xml`.
90+
+ Help updates.
91+
+ Updated sample scripts.
92+
+ Updated `README.md`.
93+
+ Removed duplicate line of code in `New-PSFormatXML`.
94+
95+
## v2.23.0
96+
97+
+ Updated `New-PSFormatXML` to include an option to wrap tables. (Issue #78)
98+
+ Updated `Add-Border` to include parameters to specify an ANSI sequence for the border and one for the text.
99+
+ Revised `Add-Border` to better support inserting blank lines.
100+
+ Updated `README.md`.
101+
102+
## v2.22.0
103+
104+
+ Modified `Set-ConsoleTitle` to move parameter validation into the `Process` script block. (Issue #75)
105+
+ Modified `Get-FolderSizeInfo` to fix an enumeration bug when used in Windows PowerShell. (Issue #77)
106+
+ Added online help links for `Get-GitSize`, `Get-ModuleCommand` and `Remove-MergedBranch`.
107+
+ Updated `foldersizeinfo.format.ps1xml` to include a view called `TB` to display values in TB.
108+
109+
## v2.21.0
110+
111+
+ Updated `Set-ConsoleTitle` and `Set-ConsoleColor` to display a warning if not in a console session. (Issue #75)
112+
+ Added `Get-GitSize` and format file `gitsize.format.ps1xml`
113+
+ Added a default ANSI color map file `psansimap.json`.
114+
+ Modified module to use a copy of `psansimap.json` in $HOME if detected. Otherwise, use the module's version.
115+
+ Create a global variable called `PSAnsiFileMap` from importing the `psansimap.json` file.
116+
+ Updated `Show-Tree` to use an ANSI color map. (Issue #69)
117+
+ Added `FileSystem-ansi.format.ps1xml` which adds a custom view called `ansi`. This colorizes files based on `$PSAnsiMap`.
118+
+ Updated `Show-Tree` to resolve child paths using `-LiteralPath`.
119+
+ Updated `README.md`
120+
121+
## v2.20.0
122+
123+
+ Restructured `Get-FileSizeInfo` to better handle Windows PowerShell. (Issue #70)
124+
+ Added `Remove-MergedBranch` with an alias of `rmb`. (Issue #71)
125+
+ Added `Get-ModuleCommand` with an alias of `gmc`.
126+
+ Added `modulecommand.format.ps1xml` to format `Get-ModuleCommand` results.
127+
+ Added an alias of `shtree` for `Show-Tree` because `pstree` is a Linux command.
128+
+ Added parameter alias `files` for `-ShowItem` in `Show-Tree`.
129+
+ Added parameter alias `properties` for `-ShowProperties` in `Show-Tree`.
130+
+ Added parameter alias `ansi` for dynamic parameter `InColor` in `Show-Tree`. (Issue #73)
131+
+ Set the default parameter value for `-Path` in `Show-Tree` to the current directory.
132+
+ Modified `Show-Tree` to allow the user to specify an array of properties. This is a __breaking change__ as the parameter has been changed from a `switch` to `string[]`. (Issue #72)
133+
+ Removed `PROPERTY` label in `Show-Tree` output when displaying properties.
134+
+ Corrected errors in the module manifest.
135+
+ Added auto completer for `Runspace` parameter in `Remove-Runspace`.
136+
+ Added alias `rfn` for `New-RandomFileName`.
137+
+ Added alias `cfn` for `New-CustomFileName`.
138+
+ Updated `README.md`.
139+
+ `ChangeLog.md` clean up.
140+
3141
## v2.19.0
4142

5143
+ Modified `Get-FolderSizeInfo` to use [system.collections.arraylist]` to improve performance. (Issue #68)

PSScriptTools.psd1

384 Bytes
Binary file not shown.

PSScriptTools.psm1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,17 @@ elseif ($psise) {
9696
}
9797
}
9898

99-
#define a function to open the PDF version of the README as a help file
100-
99+
#define a function to open the PDF version of the README and other documentation
101100
Function Open-PSScriptToolsHelp {
102101
[cmdletbinding()]
103102
Param()
104-
103+
Write-Verbose "Starting $($myinvocation.mycommand)"
105104
$pdf = Join-Path -path $PSScriptRoot -ChildPath PSScriptToolsManual.pdf
105+
Write-Verbose "Testing the path $pdf"
106106
if (Test-Path -Path $pdf) {
107107
Try {
108-
Start-Process -FilePath $pdf -ErrorAction Stop
108+
write-Verbose "Invoking the PDF"
109+
Invoke-Item -Path $pdf -ErrorAction Stop
109110
}
110111
Catch {
111112
Write-Warning "Failed to automatically open the PDF. You will need to manually open $pdf."
@@ -114,4 +115,5 @@ Function Open-PSScriptToolsHelp {
114115
else {
115116
Write-Warning "Can't find $pdf."
116117
}
118+
Write-Verbose "Ending $($myinvocation.MyCommand)"
117119
}

PSScriptToolsManual.pdf

3.86 MB
Binary file not shown.

README.md

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSScripttools.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSScripttools/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSScripttools.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSScripttools/)
44

5-
This module contains a collection of functions, variables and format files that you can use to enhance your PowerShell scripting work. Or get more done from a PowerShell prompt with less typing. Most of the commands are designed to work cross-platform. Please post any questions, problems or feedback in [Issues](https://github.com/jdhitsolutions/PSScriptTools/issues). Any feedback is greatly appreciated.
5+
This module contains a collection of functions, variables and format files that you can use to enhance your PowerShell scripting work, or get more done from a PowerShell prompt with less typing. Most of the commands are designed to work cross-platform. Please post any questions, problems, or feedback in [Issues](https://github.com/jdhitsolutions/PSScriptTools/issues). Any feedback is greatly appreciated.
66

77
*Please note that code samples have been formatted to fit an 80 character width. Some example code breaks lines without using line continuation characters. I'm trusting that you can figure out how to run the example.*
88

@@ -25,7 +25,7 @@ This module contains a collection of functions, variables and format files that
2525

2626
## Installation
2727

28-
You can get the current release from this repository or install this the [PowerShell Gallery](https://powershellgallery.com):
28+
You can get the current release from this repository or install this from the [PowerShell Gallery](https://powershellgallery.com):
2929

3030
```powershell
3131
Install-Module PSScriptTools
@@ -37,7 +37,9 @@ or in PowerShell 7:
3737
Install-Module PSScriptTools [-scope CurrentUser] [-force]
3838
```
3939

40-
> Starting in v2.2.0, the module was restructured to better support `Desktop` and `Core` editions. But starting with version 2.13.0, the module design has reverted. All commands will be exported. Anything that is platform-specific should be handled on a per-command basis. It is assumed you will be running this module in Windows PowerShell 5.1 or PowerShell 7.
40+
Starting in v2.2.0, the module was restructured to better support `Desktop` and `Core` editions. However, starting with v2.13.0, the module design has reverted. All module commands will be exported. Anything that is platform-specific should be handled on a per-command basis. It is assumed you will be running this module in Windows PowerShell 5.1 or PowerShell 7.
41+
42+
It is recommended to install this module from the PowerShell Gallery and not GitHub.
4143

4244
### Uninstall the Module
4345

@@ -50,6 +52,20 @@ Uninstall-Module PSScriptTools -allversions
5052

5153
## General Tools
5254

55+
### [Get-DirectoryInfo](docs/Get-DirectoryInfo.md)
56+
57+
This command, which has an alias of *dw*, is designed to provide quick access to top-level directory information. The default behavior is to show the total number of files in the immediate directory. Although the command will also capture the total file size in the immediate directory. You can use the Depth parameter to recurse through a specified number of levels. The default displays use ANSI escape sequences.
58+
59+
![Get-DirectoryInfo](images/dw-1.png)
60+
61+
The command output will use a wide format by default. However, other wide views are available.
62+
63+
![Get-DirectoryInfo MB](images/dw-2.png)
64+
65+
You can use the object in other ways.
66+
67+
![Get-DirectoryInfo table](images/dw-3.png)
68+
5369
### [Get-FormatView](docs/Get-FormatView.md)
5470

5571
PowerShell's formatting system includes a number of custom views that display objects in different ways. Unfortunately, this information is not readily available to a typical PowerShell user. This command displays the available views for a given object type.
@@ -1177,6 +1193,53 @@ These functions were first described at [https://jdhitsolutions.com/blog/powersh
11771193

11781194
## Console Utilities
11791195

1196+
### [ConvertTo-ASCIIArt](docs/ConvertTo-ASCIIArt.md)
1197+
1198+
`ConvertTo-ASCIIArt` can be used to transform a string of text into ASCII art. It utilizes the web service at https://artii.herokuapp.com which allows you to transform text. You might use this to create headers for your scripts or PowerShell profile.
1199+
1200+
![ConvertTo-ASCIIArt](images/cart.png)
1201+
1202+
I used this command to convert a string that I'm using with `Get-PSScriptTools` to display a "splash" header.
1203+
1204+
```powershell
1205+
$h = @"
1206+
___ ___ ___ _ _ _____ _
1207+
| _ \ __/ __|__ _ _(_)_ __| |__ _|__ ___| |___
1208+
| _\__ \__ \ _| '_| | '_ \ _|| |/ _ \ _ \ (_-<
1209+
|_| |___/___\__|_| |_| .__/\__||_|\___\___/_/__/
1210+
|_|
1211+
"@
1212+
"$([char]0x1b)[1;38;5;177m$h$([char]0x1b)[0m" | Write-Host
1213+
```
1214+
1215+
![PSScriptTools Splash](images/psscripttools-splash.png)
1216+
1217+
Expect a period of trial and error to find a good font that works with your text. The shorter your text, the better.
1218+
1219+
### [Out-Copy](docs/Out-Copy.md)
1220+
1221+
This command is intended for writers and those who need to document with PowerShell. You can pipe any command to this function and you will get the regular output in your PowerShell session.Simultaneously a copy of the output will be sent to the Windows clipboard. The copied output will include a prompt constructed from the current location unless you use the CommandOnly parameter.
1222+
1223+
You can run this a command like this:
1224+
1225+
```powershell
1226+
Get-Process | Sort WS -Descending | Select -first 5 | Out-Copy
1227+
```
1228+
1229+
And this text will be copied to the clipboard.
1230+
1231+
```text
1232+
PS C:\> Get-Process | Sort WS -Descending | Select -first 5
1233+
1234+
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
1235+
------- ------ ----- ----- ------ -- -- -----------
1236+
1849 253 810320 820112 445.38 17860 1 firefox
1237+
765 61 949028 758200 23.36 6052 0 sqlservr
1238+
446 115 441860 471032 28.59 18204 1 Teams
1239+
2307 192 313204 459616 325.23 15748 1 firefox
1240+
2050 163 451744 433772 94.63 19780 1 thunderbird
1241+
```
1242+
11801243
### [Out-More](docs/Out-More.md)
11811244

11821245
This command provides a PowerShell alternative to the cmd.exe **MORE** command, which doesn't work in the PowerShell ISE. When you have screens of information, you can page it with this function.
@@ -1399,6 +1462,22 @@ TotalMemGB FreeMemGB PctFree
13991462

14001463
## Scripting Tools
14011464

1465+
### [Get-CommandSyntax](docs/Get-CommandSyntax.md)
1466+
1467+
Some PowerShell commands are provider aware and may have special syntax or parameters depending on what PSDrive you are using when you run the command. In Windows PowerShell, the help system could show you syntax based on a given path. However, this no longer appears to work. `Get-CommandSyntax` is intended as an alternative and should work in both Windows PowerShell and PowerShell 7.
1468+
1469+
Specify a cmdlet or function name, and the output will display the syntax detected when using different providers.
1470+
1471+
```powershell
1472+
Get-CommandSyntax -Name Get-Item
1473+
```
1474+
1475+
Dynamic parameters will be highlighted with an ANSI-escape sequence.
1476+
1477+
![Get-CommandSyntax](images/get-commandsyntax.png)
1478+
1479+
This command has an alias of *gsyn*.
1480+
14021481
### [Test-Expression](docs/Test-Expression.md)
14031482

14041483
The primary command can be used to test a PowerShell expression or scriptblock for a specified number of times and calculate the average runtime, in milliseconds, over all the tests.
@@ -1901,4 +1980,4 @@ If you find this module useful, you might also want to look at my PowerShell too
19011980

19021981
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 these commands on any edition of PowerShell Core or any beta releases of PowerShell 7.
19031982

1904-
Last Updated *2020-10-12 16:08:05Z*
1983+
Last Updated *2020-10-26 19:37:54Z*

0 commit comments

Comments
 (0)