Skip to content

Commit 03d1211

Browse files
2.34.0 changes
1 parent 6a269bb commit 03d1211

File tree

101 files changed

+2790
-790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2790
-790
lines changed

Archive-ChangeLog.md

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

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

5+
## v2.31.0
6+
7+
+ Merged PR from @corbob to fix an issue detecting profiles scripts when the user's Documents location has changed. (Issue #93)
8+
+ Modified `Convert-HasthtableToCode` to explicitly use `@()` for array elements. This is a continuation of a fix for Issue #91.
9+
+ Updated `New-PSFormatXML` to process a custom hashtable as a property name and convert the XML property to a scriptblock.
10+
+ Updated `New-PSFormatXML` so that Wide views are auto-sized by default.
11+
+ Modified the metadata comment generated by `New-PSFormatXML`.
12+
+ Modified `New-PSFormatXML` to only display the warning message once when detecting additional objects.
13+
+ Added `Get-FormatView` with an alias of `gfv` to show defined format views. This command uses a format file, `formatview.format.ps1xml`.
14+
+ Added `Changelog.md` to `PSScriptToolsManual.pdf`.
15+
+ Moved older change log information to `Archive-Changelog.md`.
16+
+ Help and documentation updates.
17+
18+
## v2.30.0
19+
20+
+ Fixed a bug in `Convert-HashtableToCode` when converting hashtables with nested hashtables. (Issue #91)
21+
+ Modified `Convert-HashtableToCode` to honor `-Inline` when processing nested hashtables.
22+
+ Updated help documentation for `Convert-HashtableToCode` to clarify the use of array values in a hashtable.
23+
524
## v2.29.0
625

726
+ Modified `Get-WindowsVersion` to not use remoting when connecting to the local computer. (Issue #90)

PSScriptTools.psd1

2.15 KB
Binary file not shown.

PSScriptTools.psm1

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,33 @@ Get-ChildItem -path $PSScriptRoot\functions\*.ps1 | ForEach-Object -process {
1111

1212
Write-Verbose "Define the global PSAnsiFileMap variable"
1313
$json = "psansifilemap.json"
14-
#test for user version
14+
15+
#test for user version in $HOME
1516
$userjson = Join-Path -path $HOME -ChildPath $json
1617
$modjson = Join-Path -path $PSScriptRoot -ChildPath $json
1718

1819
if (Test-Path -path $userjson) {
1920
$map = $userjson
2021
}
2122
else {
23+
#use the file from this module
2224
$map = $modjson
2325
}
2426

25-
Set-Variable -Name PSAnsiFileMap -value (Get-Content -path $map | ConvertFrom-Json) -Scope Global
27+
#ConvertFrom-Json doesn't write simple objects to the pipeline in Windows PowerShell so I
28+
#need to process the results individually.
29+
$mapData = [System.Collections.Generic.List[object]]::new()
30+
31+
Get-Content -path $map | ConvertFrom-Json | Foreach-Object {$_} | foreach-Object {
32+
$entry = [pscustomobject]@{
33+
PSTypeName = "PSAnsiFileEntry"
34+
Description = $_.description
35+
Pattern = $_.pattern
36+
Ansi = $_.ansi
37+
}
38+
$mapData.Add($entry)
39+
}
40+
Set-Variable -Name PSAnsiFileMap -value $mapdata -Scope Global
2641

2742
Write-Verbose "Define special character map"
2843
$global:PSSpecialChar = @{

PSScriptToolsManual.pdf

2.33 MB
Binary file not shown.

README.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The contents of this file and other documentation can be viewed using the `Open-
2323
+ [Console Utilities](#Console-Utilities)
2424
+ [Format Functions](#Format-Functions)
2525
+ [Scripting Tools](#Scripting-Tools)
26+
+ [ANSI Tools](#Ansi-Tools)
2627
+ [Other Module Features](#Other-Module-Features)
2728
+ [Related Modules](#Related-Modules)
2829
+ [Compatibility](#Compatibility)
@@ -1088,7 +1089,7 @@ Get-Process | after (Get-Date).Addminutes(-1) -Property StartTime
10881089

10891090
This is selecting all processes that started within the last minute.
10901091

1091-
### [Select-Before](docs/Select-Before.md)]
1092+
### [Select-Before](docs/Select-Before.md)
10921093

10931094
`Select-Before` is the opposite of `Select-After`.
10941095

@@ -1987,9 +1988,9 @@ Mode LastWriteTime Length Name
19871988

19881989
You will need to manually install the file.
19891990

1990-
## Other Module Features
1991+
## ANSI Tools
19911992

1992-
From time to time I will include additional items that you might find useful in your PowerShell work. This module includes several custom format files for common objects like services. You can run `Get-Service` and pipe it to the custom table view.
1993+
This module includes several custom format files for common objects like services. You can run `Get-Service` and pipe it to the custom table view.
19931994

19941995
```powershell
19951996
Get-Service | Format-Table -view ansi
@@ -2069,11 +2070,11 @@ TopContainer
20692070
ChildContainer
20702071
```
20712072

2072-
The map includes ANSI settings for different file types. You won't see the ANSI value in the output. The module will add a custom table view called `ansi` which you can use to display file results colorized in PowerShell 7.
2073+
The map includes ANSI settings for different file types. You won't see the ANSI value in the output. The module will add a custom table view called `ansi` which you can use to display colorized file results.
20732074

20742075
![ANSI File listing](images/ansi-file-format.png)
20752076

2076-
The mapping file is user-customizable. Copy the `psansifilemap.json` file from the module's root directory to $HOME. When you import this module, if the file is found, it will be imported and used as `psansifilemap`, otherwise the module's file will be used.
2077+
The mapping file is user-customizable. Copy the `psansifilemap.json` file from the module's root directory to $HOME. When you import this module, if the file is found, it will be imported and used as `psansifilemap`, otherwise, the module's file will be used.
20772078

20782079
The file will look like this:
20792080

@@ -2127,7 +2128,39 @@ The file will look like this:
21272128
]
21282129
```
21292130

2130-
You can create or modify file groups. The Pattern value should be a regular expression pattern to match on the filename. Don't forget you will need to escape characters for the JSON format. The Ansi value will be an ANSI escape sequence. You can use `\u001b` for the \``e` character.
2131+
You can create or modify file groups. The Pattern value should be a regular expression pattern to match the filename. Don't forget you will need to escape characters for the JSON format. The Ansi value will be an ANSI escape sequence. You can use `\u001b` for the \``e` character.
2132+
2133+
If you prefer not to edit JSON files, you can use the PSAnsiFileMap commands from the module.
2134+
2135+
### [Get-PSAnsiFileMap](docs/Get-PSAnsiFileMap.md)
2136+
2137+
This command will display the value of the `$PSAnsiFileMap` variable, but will also show the ANSI sequence using the sequence itself.
2138+
2139+
![get-psansifilemap](images/get-psansifilemap.png)
2140+
2141+
### [Set-PSAnsiFileMap](docs/Set-PSAnsiFileMap.md)
2142+
2143+
Use this command to modify an existing entry. You need to specify a regular expression pattern to match on the filename and/or an ANSI escape sequence. If the entry description doesn't exist, you will need to specify the regex pattern and the ANSI sequence to add the entry to $PSAnsiFileMap.
2144+
2145+
```powershell
2146+
Set-PSAnsiFileMap Archive -Ansi "`e[38;5;75m"
2147+
```
2148+
2149+
### [Remove-PSAnsiFileEntry](docs/Remove-PSAnsiFileEntry.md)
2150+
2151+
If you need to, you can remove an entry from `$PSAnsiFileMap`.
2152+
2153+
```powershell
2154+
Remove-PSAnsiFileEntry DevFiles
2155+
```
2156+
2157+
### [Export-PSAnsiFileMap](docs/Export-PSAnsiFileMap.md)
2158+
2159+
Any changes you make to `$PSAnsiFileMap` will only last until you import the module again. To make the change permanent, use [Export-PSAnsiFileMap](docs/Export-PSAnsiFileMap.md). This will create the `psansifilemap.json` file in your `$HOME` directory. When you import the PSSCriptTools module, if this file is found, it will be imported. Otherwise, the default module file will be used.
2160+
2161+
## Other Module Features
2162+
2163+
From time to time I will include additional items that you might find useful in your PowerShell work.
21312164

21322165
### PSSpecialChar
21332166

@@ -2181,4 +2214,4 @@ If you find this module useful, you might also want to look at my PowerShell too
21812214

21822215
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.
21832216

2184-
Last Updated *2020-11-12 18:56:02Z*
2217+
Last Updated *2020-12-28 18:38:04Z*

changelog.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# Change Log for PSScriptTools
22

3-
This is the most recent change log history for this module.
3+
This is the most recent change history for this module.
4+
5+
## v2.34.0
6+
7+
+ Fixed typo bug in `Get-PSScriptTools` that was failing to get command aliases. (Issue #99)
8+
+ Modified `Get-PSScriptTools` to improve performance. Assuming that all exported functions use standard verbs.
9+
+ Added `Get-PSAnsiFileMap`.
10+
+ Added `Set-PSAnsiFileMapEntry`.
11+
+ Added `Remove-PSAnsiFileMapEntry`.
12+
+ Added `Export-PSAnsiFileMap`.
13+
+ Added `Show-ANSISequence`.
14+
+ Updated `filesystem.ansi.format.ps1xml` to use last matching pattern.
15+
+ Modified `Show-Tree` to better handle piped-in file and directory objects.
16+
+ Added an alias `ab` for `Add-Border`.
17+
+ Added an alias of `nab` for `New-AnsiBar`.
18+
+ Updated `README.md`.
19+
+ Help updates.
420

521
## v2.33.1
622

@@ -34,25 +50,6 @@ This is the most recent change log history for this module.
3450
+ Added a splash header to `Get-PSScriptTools`. The header writes to the host so it isn't part of the command output.
3551
+ Updated `README.md`.
3652

37-
## v2.31.0
38-
39-
+ Merged PR from @corbob to fix an issue detecting profiles scripts when the user's Documents location has changed. (Issue #93)
40-
+ Modified `Convert-HasthtableToCode` to explicitly use `@()` for array elements. This is a continuation of a fix for Issue #91.
41-
+ Updated `New-PSFormatXML` to process a custom hashtable as a property name and convert the XML property to a scriptblock.
42-
+ Updated `New-PSFormatXML` so that Wide views are auto-sized by default.
43-
+ Modified the metadata comment generated by `New-PSFormatXML`.
44-
+ Modified `New-PSFormatXML` to only display the warning message once when detecting additional objects.
45-
+ Added `Get-FormatView` with an alias of `gfv` to show defined format views. This command uses a format file, `formatview.format.ps1xml`.
46-
+ Added `Changelog.md` to `PSScriptToolsManual.pdf`.
47-
+ Moved older change log information to `Archive-Changelog.md`.
48-
+ Help and documentation updates.
49-
50-
## v2.30.0
51-
52-
+ Fixed a bug in `Convert-HashtableToCode` when converting hashtables with nested hashtables. (Issue #91)
53-
+ Modified `Convert-HashtableToCode` to honor `-Inline` when processing nested hashtables.
54-
+ Updated help documentation for `Convert-HashtableToCode` to clarify the use of array values in a hashtable.
55-
5653
## Archive
5754

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

docs/Add-Border.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Add-Border [-TextBlock] <String[]> [-Character <String>] [-InsertBlanks]
2929

3030
## DESCRIPTION
3131

32-
This command will create a character or text based border around a line of text. You might use this to create a formatted text report or to improve the display of information to the screen.
32+
This command will create a character or text-based border around a line of text. You might use this to create a formatted text report or to improve the display of information to the screen.
3333

3434
## EXAMPLES
3535

@@ -247,7 +247,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
247247
248248
## OUTPUTS
249249
250-
### [System.String]
250+
### System.String
251251
252252
## NOTES
253253

docs/Compare-Module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
129129
130130
## INPUTS
131131
132-
### [string]
132+
### System.String
133133
134134
## OUTPUTS
135135

docs/Compare-Script.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ PS C:\> Compare-Script | Where-object {$_.UpdateNeeded}
3131
Name : DNSSuffix
3232
OnlineVersion : 0.4.1
3333
InstalledVersion : 0.2.0
34-
PublishedDate : 10/22/2018 8:21:46 PM
34+
PublishedDate : 10/22/2020 8:21:46 PM
3535
UpdateNeeded : True
3636
3737
Name : InvokeBuild
3838
OnlineVersion : 5.4.2
3939
InstalledVersion : 3.2.2
40-
PublishedDate : 12/7/2018 1:30:46 AM
40+
PublishedDate : 12/7/2020 1:30:46 AM
4141
UpdateNeeded : True
4242
...
4343
```
@@ -48,7 +48,7 @@ List all scripts that could be updated.
4848

4949
```powershell
5050
PS C:\> Compare-Script | Where UpdateNeeded |
51-
Out-Gridview -title "Select scripts to update" -outputMode multiple |
51+
Out-Gridview -Title "Select scripts to update" -OutputMode multiple |
5252
Foreach-Object { Update-Script $_.name }
5353
```
5454

@@ -95,7 +95,7 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
9595
9696
## INPUTS
9797
98-
### [string]
98+
### System.String
9999
100100
## OUTPUTS
101101

docs/Convert-CommandToHashtable.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Convert-CommandToHashtable [-Text] <String> [<CommonParameters>]
1919

2020
## DESCRIPTION
2121

22-
This command is intended to convert a long PowerShell expression with named parameters into a splatting alternative. The central concept is that you are editing a script file with a lengthy PowerShell expression using a number of parameters and you would like to turn it into splatting code.
22+
This command is intended to convert a long PowerShell expression with named parameters into a splatting alternative. The central concept is that you are editing a script file with a lengthy PowerShell expression with multiple parameters and you would like to turn it into splatting code.
2323

2424
## EXAMPLES
2525

@@ -61,7 +61,7 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink
6161
6262
## OUTPUTS
6363
64-
### [Hashtable]
64+
### Hashtable
6565
6666
## NOTES
6767

0 commit comments

Comments
 (0)