Skip to content

Commit

Permalink
v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Oct 11, 2024
1 parent c89a71e commit f67829c
Show file tree
Hide file tree
Showing 23 changed files with 414 additions and 417 deletions.
168 changes: 87 additions & 81 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,145 +1,151 @@
# Change Log for PSTypeExtensionTools

## v1.10.0

- Code cleanup and re-formatting.
- Help updates.
- Updated `README.md`.

## v1.9.0

+ Fixed bug in `New-PSPropertySet` that failed to recognize a custom type. ([Issue #21](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/21))
+ Re-organized module layout.
+ Help updates.
+ Updated `README.md`.
- Fixed bug in `New-PSPropertySet` that failed to recognize a custom type. ([Issue #21](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/21))
- Re-organized module layout.
- Help updates.
- Updated `README.md`.

## v1.8.0

+ Fixed bugs in `Get-PSTypeExtension` and `Export-PSTypeExtension` where I needed to let the user force recognizing a type name. ([Issue #20](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/20))
+ Help updates.
+ Updated `README.md`.
- Fixed bugs in `Get-PSTypeExtension` and `Export-PSTypeExtension` where I needed to let the user force recognizing a type name. ([Issue #20](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/20))
- Help updates.
- Updated `README.md`.

## v1.7.1

+ Fixed bug in `New-PSPropertySet` that failed to correct typename case. ([Issue #19](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/19))
+ Updated online help link for `New-PSPropertySet`.
+ Added sample file `process.types.ps1xml`.
+ Updated `README.md`.
- Fixed bug in `New-PSPropertySet` that failed to correct typename case. ([Issue #19](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/19))
- Updated online help link for `New-PSPropertySet`.
- Added sample file `process.types.ps1xml`.
- Updated `README.md`.

## v1.7.0

+ Added `services.types.ps1xml` to samples folder.
+ Updated `README.md`.
+ Updates `README.md` in Samples folder.
+ Changed statements using `Out-Null` to use `[void]`.
+ Modified `Export-PSTypeExtension` to support appending in a very specific use-case. ([Issue #16](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/16))
+ Added a private function, `_convertTypeName` to convert typename values to properly cased names.
+ Modified `Export-PSTypeExtension` to add a `-Passthru` parameter. ([Issue #18](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/18))
+ Updated help.
- Added `services.types.ps1xml` to samples folder.
- Updated `README.md`.
- Updates `README.md` in Samples folder.
- Changed statements using `Out-Null` to use `[void]`.
- Modified `Export-PSTypeExtension` to support appending in a very specific use-case. ([Issue #16](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/16))
- Added a private function, `_convertTypeName` to convert typename values to properly cased names.
- Modified `Export-PSTypeExtension` to add a `-Passthru` parameter. ([Issue #18](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/18))
- Updated help.

## v1.6.0

+ Re-organized module structure.
+ Added command `New-PSPropertySet`to create a ps1xml file that defines a custom property set. ([Issue #15](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/15))
+ Modified `Get-PSTypeExtension` to hide `CodeProperty` values by defaults. ([Issue #17](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/1))
+ Modified `Get-PSTypeExtension` to display results sorted by member type and name.
- Re-organized module structure.
- Added command `New-PSPropertySet`to create a ps1xml file that defines a custom property set. ([Issue #15](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/15))
- Modified `Get-PSTypeExtension` to hide `CodeProperty` values by defaults. ([Issue #17](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/1))
- Modified `Get-PSTypeExtension` to display results sorted by member type and name.

## v1.5.1

+ Fixed error in exporting aliases.
+ Updated license file.
+ Very minor help corrections.
- Fixed error in exporting aliases.
- Updated license file.
- Very minor help corrections.

## v1.5.0

+ Added new parameter, `-IncludeDeserialized`, on `Add-PSTypeExtension` ([Issue #14](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/14))
+ Modified `Import-PSTypeExtension` to allow piping files into the command.
+ Added alias `Type` to `-MemberType` parameter of `Add-PSTypeExtension`
+ Added alias `Name` to `-MemberName` parameter of `Add-PSTypeExtension`
+ Added online help links.
+ Updated some of the sample JSON files to include deserialized type versions.
+ Updated help documentation.
+ Updated `README.md`.
- Added new parameter, `-IncludeDeserialized`, on `Add-PSTypeExtension` ([Issue #14](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/14))
- Modified `Import-PSTypeExtension` to allow piping files into the command.
- Added alias `Type` to `-MemberType` parameter of `Add-PSTypeExtension`
- Added alias `Name` to `-MemberName` parameter of `Add-PSTypeExtension`
- Added online help links.
- Updated some of the sample JSON files to include deserialized type versions.
- Updated help documentation.
- Updated `README.md`.

## v1.4.0

+ Modified manifest to require PowerShell 5.1.
+ Modified manifest to support both Desktop and Core PSEditions.
+ Updates to some of the sample files.
+ Updated `README.md`.
- Modified manifest to require PowerShell 5.1.
- Modified manifest to support both Desktop and Core PSEditions.
- Updates to some of the sample files.
- Updated `README.md`.

## v1.3.0

+ File cleanup for the PowerShell Gallery.
+ Exported Samples folder as a variable to make it easier to import.
+ code cleanup
+ markdown cleanup
+ help cleanup
+ Updates to `README.md`
- File cleanup for the PowerShell Gallery.
- Exported Samples folder as a variable to make it easier to import.
- code cleanup
- markdown cleanup
- help cleanup
- Updates to `README.md`

## v1.1.0

+ Fixed `Import-PSTypeExtension` bug piping in json/xml files ([Issue #13](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/13))
+ Updated About help documentation
+ Modified pipeline processing in `Get-PSTypeExtension` ([Issue #12](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/12))
- Fixed `Import-PSTypeExtension` bug piping in json/xml files ([Issue #13](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/13))
- Updated About help documentation
- Modified pipeline processing in `Get-PSTypeExtension` ([Issue #12](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/12))

## v1.0.0

+ Modified `Export-PSTypeExtension` to export to a ps1xml file ([Issue #11](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/11))
+ release to the PowerShell Gallery
+ Updated documentation
+ Updated samples
- Modified `Export-PSTypeExtension` to export to a ps1xml file ([Issue #11](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/11))
- release to the PowerShell Gallery
- Updated documentation
- Updated samples

## v0.5.1

+ fixed bug in the CimInstance json sample
+ fixed link bug in README.md file
- fixed bug in the CimInstance json sample
- fixed link bug in README.md file

## v0.5.0

+ Modified `Get-PSType` to better reflect type names. ([Issue #7](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/7))
+ added additional sample files.
+ modified `Get-PSTypeExtension` to include PSTypeExtension as a typename
+ added format ps1xml (Issue #8)
+ revised parameter validation for `Get-PSTypeExtension` ([Issue #10](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/10))
+ revised `Import-PSTypeExtension` to accept pipelined input for filenames ([Issue #9](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/9))
+ updated documentation
- Modified `Get-PSType` to better reflect type names. ([Issue #7](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/7))
- added additional sample files.
- modified `Get-PSTypeExtension` to include PSTypeExtension as a typename
- added format ps1xml (Issue #8)
- revised parameter validation for `Get-PSTypeExtension` ([Issue #10](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/10))
- revised `Import-PSTypeExtension` to accept pipelined input for filenames ([Issue #9](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/9))
- updated documentation

## v0.4.0

+ Modified `Get-PSTypeExtension` so +All is the default ([Issue #6](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/6))
+ Modified `Get-PSTypeExtension` to validate typename
+ Updated help documentation to include an About file
+ Reverted Changelog to a text file
+ Updated Strings sample file.
- Modified `Get-PSTypeExtension` so -All is the default ([Issue #6](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/6))
- Modified `Get-PSTypeExtension` to validate typename
- Updated help documentation to include an About file
- Reverted Changelog to a text file
- Updated Strings sample file.

## v0.3.0

+ fixed bug in `Get-PSTypeExtension` that was writing a blank object to the pipeline. ([Issue #3](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/3))
+ Added support for WhatIf to `Export-PSTypeExtension` ([Issue #2](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/2))
+ documentation update
- fixed bug in `Get-PSTypeExtension` that was writing a blank object to the pipeline. ([Issue #3](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/3))
- Added support for WhatIf to `Export-PSTypeExtension` ([Issue #2](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/2))
- documentation update

## v0.2.0

+ renamed commands to be consistent with the module name
+ updated help documentation
+ Added `Set-PSTypeExtension` as an alias to `Add-PSTypeExtension`
- renamed commands to be consistent with the module name
- updated help documentation
- Added `Set-PSTypeExtension` as an alias to `Add-PSTypeExtension`

## v0.1.0

+ major changes to functions and design
+ Added `Get-PSType` function
+ Added `Get-MyTypeExtension` function
+ Added `Get-MyTypeExtension` function
- major changes to functions and design
- Added `Get-PSType` function
- Added `Get-MyTypeExtension` function
- Added `Get-MyTypeExtension` function

## v0.0.4

+ Updated to handle other member type ([Issue #2](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/2))
- Updated to handle other member type ([Issue #2](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/2))

## v0.0.3

+ added ShouldSupportProcess for `Import-MyTypeExtension` ([Issue #1](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/1)
+ updated help
+ updated manifest
- added ShouldSupportProcess for `Import-MyTypeExtension` ([Issue #1](https://github.com/jdhitsolutions/PSTypeExtensionTools/issues/1)
- updated help
- updated manifest

## v0.0.2

+ added a manifest
- added a manifest

## v0.0.1

+ Initial module
- Initial module
2 changes: 1 addition & 1 deletion License.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2022 JDH Information Technology Solutions, Inc.
Copyright (c) 2017-2024 JDH Information Technology Solutions, Inc.


Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
Binary file modified PSTypeExtensionTools.psd1
Binary file not shown.
3 changes: 1 addition & 2 deletions PSTypeExtensionTools.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

Get-ChildItem $PSScriptRoot\Functions\*.ps1 |
Foreach-object { . $_.fullname}
Foreach-object { . $_.FullName}

#Export the Samples folder location as a variable
$PSTypeSamples = Join-Path $PSScriptRoot -ChildPath samples
Expand Down
81 changes: 41 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Show-Command Add-PSTypeExtension
Clicking Run will insert this code at your prompt.

```powershell
Add-PSTypeExtension -MemberName ToTitleCase -MemberType ScriptMethod -TypeName System.String -Value { (Get-Culture).TextInfo.ToTitleCase($this.tolower())}
Add-PSTypeExtension -MemberName ToTitleCase -MemberType ScriptMethod -TypeName System.String -Value { (Get-Culture).TextInfo.ToTitleCase($this.ToLower())}
```

If you like this extension, you can export it and re-import it later.
Expand Down Expand Up @@ -134,7 +134,7 @@ Let's say you have loaded the sample 'System.IO.FileInfo` type extensions from t

```powershell
Import-PSTypeExtension -Path $PSTypeSamples\fileinfo-extensions.json
```powershell
```

You could write a command like this:

Expand All @@ -145,25 +145,25 @@ dir c:\work -file | Select-Object Name,Size,LastWriteTime,Age
Or you could create a custom property set. These have to be defined in `ps1xml` files. The `New-PSPropertySet` simplifies this process.

```powershell
New-PSPropertySet -Typename System.IO.FileInfo -Name FileAge -Properties Name,Size,LastWriteTime,Age -FilePath d:\temp\Fileinfo.types.ps1xml
New-PSPropertySet -Typename System.IO.FileInfo -Name FileAge -Properties Name,Size,LastWriteTime,Age -FilePath d:\temp\FileInfo.types.ps1xml
```

I've included the file in the Samples folder.

```dos
PS C:\> Update-TypeData $PSTypeSamples\fileinfo.types.ps1xml
PS C:\> dir c:\work -file | Select-Object fileage
PS C:\> Update-TypeData $PSTypeSamples\FileInfo.types.ps1xml
PS C:\> dir c:\work -file | Select-Object FileAge
Name Size LastWriteTime Age
---- ---- - ----------- ---
a.dat 42 2/12/2021 5:36:55 PM 23.17:27:21
a.txt 14346 12/31/2020 9:10:15 AM 67.01:54:00
a.xml 171394 12/31/2020 12:15:44 PM 66.22:48:32
aa.ps1 28866 12/31/2020 9:13:16 AM 67.01:51:00
aa.txt 28866 12/31/2020 9:11:18 AM 67.01:52:58
about.json 16455 2/27/2021 10:11:03 AM 09.00:53:12
about_ADReportingTools 1688 3/4/2021 7:37:01 PM 03.15:27:14
b.csv 1273 11/13/2020 12:11:35 PM 114.22:52:40
a.dat 42 2/12/2024 5:36:55 PM 23.17:27:21
a.txt 14346 12/31/2023 9:10:15 AM 67.01:54:00
a.xml 171394 12/31/2023 12:15:44 PM 66.22:48:32
aa.ps1 28866 12/31/2023 9:13:16 AM 67.01:51:00
aa.txt 28866 12/31/2023 9:11:18 AM 67.01:52:58
about.json 16455 2/27/2024 10:11:03 AM 09.00:53:12
about_ADReportingTools 1688 3/4/2024 7:37:01 PM 03.15:27:14
b.csv 1273 11/13/2023 12:11:35 PM 114.22:52:40
...
```

Expand All @@ -180,20 +180,20 @@ Here's how this might look.
First, create a property set file.

```powershell
New-PSPropertySet -Typename system.io.fileinfo -Name TimeSet -Properties "Name","Length","CreationTime","LastWriteTime" -FilePath c:\work\file.types.ps1xml
New-PSPropertySet -Typename System.IO.FileInfo -Name TimeSet -Properties "Name","Length","CreationTime","LastWriteTime" -FilePath c:\work\file.types.ps1xml
```

I'll define a few type extensions.

```powershell
Add-PSTypeExtension -TypeName system.io.fileinfo -MemberType AliasProperty -MemberName Size -Value Length
Add-PSTypeExtension -TypeName system.io.fileinfo -MemberType ScriptProperty -MemberName ModifiedAge -Value {New-TimeSpan -Start $this.lastwritetime -End (Get-Date)}
Add-PSTypeExtension -TypeName System.IO.FileInfo -MemberType AliasProperty -MemberName Size -Value Length
Add-PSTypeExtension -TypeName System.IO.FileInfo -MemberType ScriptProperty -MemberName ModifiedAge -Value {New-TimeSpan -Start $this.LastWriteTime -End (Get-Date)}
```

I'll even add a second property set to the same file using these new extensions.

```powershell
Export-PSTypeExtension -TypeName system.io.fileinfo -MemberName Size,ModifiedAge -Path c:\work\file.types.ps1xml -append
Export-PSTypeExtension -TypeName System.IO.FileInfo -MemberName Size,ModifiedAge -Path c:\work\file.types.ps1xml -append
```

I'll end up with this file:
Expand All @@ -207,7 +207,7 @@ the PowerShell Gallery.
Use Update-TypeData to append this file in your PowerShell session.
Created 03/09/2021 15:27:56
Created 03/09/2024 15:27:56
-->
<Types>
<Type>
Expand Down Expand Up @@ -247,21 +247,22 @@ Created 03/09/2021 15:27:56
In PowerShell, I can load this file and use it.

```powershell
PS C:\> Update-Typedata c:\work\file.types.ps1xml
PS C:\> Get-Childitem -path c:\work\*.csv | Sort-Object -property size -Descending | Select Age
PS C:\> Update-TypeData c:\work\file.types.ps1xml
PS C:\> Get-ChildItem -path c:\work\*.csv |
Sort-Object -property size -Descending | Select Age
Name Size LastWriteTime ModifiedAge
---- ---- ------------- -----------
updates.csv 4021821 11/14/2020 9:00:48 AM 115.06:45:35.2595780
part5.csv 7332 2/27/2021 6:10:11 PM 9.21:36:12.4672428
ipperf.csv 5008 11/4/2020 11:36:20 AM 125.04:10:03.4641251
localusers.csv 1480 2/27/2021 4:39:32 PM 9.23:06:51.7431393
b.csv 1273 11/13/2020 12:11:35 PM 116.03:34:48.0298279
foo.csv 1077 11/13/2020 12:40:04 PM 116.03:06:19.3069112
y.csv 524 11/19/2020 2:11:44 PM 110.01:34:39.0826388
yy.csv 524 12/1/2020 11:28:03 AM 98.04:18:20.7080948
c.csv 334 11/13/2020 11:58:15 AM 116.03:48:08.3898463
a.csv 0 12/1/2020 11:30:55 AM 98.04:15:27.9106911
updates.csv 4021821 11/14/2023 9:00:48 AM 115.06:45:35.2595780
part5.csv 7332 2/27/2024 6:10:11 PM 9.21:36:12.4672428
ipperf.csv 5008 11/4/2023 11:36:20 AM 125.04:10:03.4641251
localusers.csv 1480 2/27/2024 4:39:32 PM 9.23:06:51.7431393
b.csv 1273 11/13/2023 12:11:35 PM 116.03:34:48.0298279
foo.csv 1077 11/13/2023 12:40:04 PM 116.03:06:19.3069112
y.csv 524 11/19/2023 2:11:44 PM 110.01:34:39.0826388
yy.csv 524 12/1/2023 11:28:03 AM 98.04:18:20.7080948
c.csv 334 11/13/2023 11:58:15 AM 116.03:48:08.3898463
a.csv 0 12/1/2023 11:30:55 AM 98.04:15:27.9106911
```

I can put the `Update-TypeData` command in my PowerShell profile to always have these extensions. Or I could share the file.
Expand All @@ -279,16 +280,16 @@ PS C:\> Get-ChildItem $PSTypeSamples
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/15/2017 2:25 PM 766 cimlogicaldisk-extensions.json
-a---- 9/28/2018 9:48 AM 265 datetime-extensions.json
-a---- 12/15/2017 5:09 PM 232 eventlog-type.json
-a---- 2/18/2019 1:18 PM 1266 fileinfo-extensions.json
-a---- 11/13/2017 8:37 AM 901 int32-types.json
-a---- 11/1/2017 6:18 PM 653 measure-extensions.json
-a---- 11/13/2017 8:49 AM 890 process-types.xml
-a---- 12/15/2017 6:09 PM 628 README.md
-a---- 12/15/2017 2:09 PM 1246 stringtypes.json
-a---- 11/9/2017 12:08 PM 3024 vm-extensions.json
-a---- 12/15/2023 2:25 PM 766 cimlogicaldisk-extensions.json
-a---- 9/28/2024 9:48 AM 265 datetime-extensions.json
-a---- 12/15/2023 5:09 PM 232 eventlog-type.json
-a---- 2/18/2024 1:18 PM 1266 fileinfo-extensions.json
-a---- 11/13/2023 8:37 AM 901 int32-types.json
-a---- 11/1/2023 6:18 PM 653 measure-extensions.json
-a---- 11/13/2023 8:49 AM 890 process-types.xml
-a---- 12/15/2023 6:09 PM 628 README.md
-a---- 12/15/2023 2:09 PM 1246 stringtypes.json
-a---- 11/9/2023 12:08 PM 3024 vm-extensions.json
PS C:\> Import-PSTypeExtension $PSTypeSamples\measure-extensions.json -Verbose
VERBOSE: Starting: Import-PSTypeExtension
Expand Down
Loading

0 comments on commit f67829c

Please sign in to comment.