diff --git a/build.ps1 b/build.ps1
index d344858..e97538f 100644
--- a/build.ps1
+++ b/build.ps1
@@ -45,11 +45,13 @@ $csproj = [System.IO.Path]::Combine($src, "dotnet", "dependencies.csproj")
$bin = [System.IO.Path]::Combine($src, "dotnet", "bin")
$obj = [System.IO.Path]::Combine($src, "dotnet", "obj")
$lib = [System.IO.Path]::Combine($publish, "lib")
+$ps51 = [System.IO.Path]::Combine($src, "ps51")
Write-Host "src: $src"
Write-Host "docs: $docs"
Write-Host "publish: $publish"
Write-Host "lib: $lib"
+Write-Host "ps51: $ps51"
Write-Host "dotnet: $([Environment]::Version)"
Write-Host "ps: $($PSVersionTable.PSVersion)"
@@ -64,7 +66,7 @@ $manifest = @{
FunctionsToExport = @()
ModuleVersion = [version]::new($Major, $Minor, $Build, $Revision)
- PowerShellVersion = '7.4'
+ PowerShellVersion = '5.1'
ProjectUri = "https://github.com/dfinke/PowerShellHumanizer"
LicenseUri = "https://github.com/dfinke/PowerShellHumanizer/blob/master/LICENSE.txt"
RootModule = "$module.psm1"
@@ -105,6 +107,9 @@ function Build {
Get-ChildItem -Path $lib -filter "*.pdb" | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path $lib -filter "System.Management.Automation.dll" | Remove-Item -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path $lib -filter "dependencies.dll" | Remove-Item -Force -ErrorAction SilentlyContinue
+
+ # Copy PowerShell 5.1 dll's
+ Copy-Item -Path "$ps51/*.dll" -Destination "$publish/lib"
Copy-Item -Path "$src/$module.psm1" -Destination $publish
Copy-Item -Path @("$parent/README.md") -Destination $publish -ErrorAction SilentlyContinue
diff --git a/src/PowerShellHumanizer.psm1 b/src/PowerShellHumanizer.psm1
index ae7c3fc..3d6cc3e 100644
--- a/src/PowerShellHumanizer.psm1
+++ b/src/PowerShellHumanizer.psm1
@@ -1,13 +1,9 @@
# Load dlls
-Add-Type -Path "$PSScriptRoot/lib/Humanizer.dll"
-
-if ($PSCulture -ne 'en-US') {
- if (Test-Path "$PSScriptRoot/lib/$PSCulture") {
- Add-Type -Path "$PSScriptRoot/lib/$PSCulture/Humanizer.resources.dll"
- } else {
- Write-Warning "Humanizer doesn't currently support '$PSCulture'."
- }
+if ($PSVersionTable.PSVersion.Major -lt 6) {
+ Add-Type -Path "$PSScriptRoot/lib/System.Buffers.4.0.2.0.dll"
+ Add-Type -Path "$PSScriptRoot/lib/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll"
}
+Add-Type -Path "$PSScriptRoot/lib/Humanizer.dll"
if (Get-Module -Name Terminal-Icons -ListAvailable -ErrorAction SilentlyContinue) {
Update-FormatData -PrependPath "$PSSCriptRoot/formats/FileInfoIcons.format.ps1xml"
diff --git a/src/dotnet/dependencies.csproj b/src/dotnet/dependencies.csproj
index 088183d..9169b7a 100644
--- a/src/dotnet/dependencies.csproj
+++ b/src/dotnet/dependencies.csproj
@@ -2,11 +2,11 @@
netstandard2.0
- 3.0.0-beta.13
+ 3.0.0-beta.54
-
+
diff --git a/src/en-US/about_PowerShellHumanizer.help.txt b/src/en-US/about_PowerShellHumanizer.help.txt
index b71cea1..3c2174f 100644
--- a/src/en-US/about_PowerShellHumanizer.help.txt
+++ b/src/en-US/about_PowerShellHumanizer.help.txt
@@ -54,7 +54,7 @@ INTEGER EXTENSION PROPERTIES
.Milliseconds
TIMESPAN EXTENSION METHODS
- .Humanize([int]Precision)
+ .Humanize([int]Precision, [CultureInfo]Culture, [Humanizer.TimeUnit]MaxUnit, [string]CollectionSeparator, [bool]ToWords)
DATETIME EXTENSION METHODS
.Humanize([bool]UTC)
\ No newline at end of file
diff --git a/src/formats/FileInfo.format.ps1xml b/src/formats/FileInfo.format.ps1xml
index f335a03..f69b9fa 100644
--- a/src/formats/FileInfo.format.ps1xml
+++ b/src/formats/FileInfo.format.ps1xml
@@ -1,3 +1,4 @@
+
@@ -8,7 +9,6 @@
-
@@ -22,12 +22,12 @@
-
- $_.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")
-
+
+ $_.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")
+
-
+
@@ -35,26 +35,24 @@
-
-
-
+
children
FileSystemTypes
- PSParentPath
- FileSystemTypes-GroupingFormat
+ PSParentPath
+ FileSystemTypes-GroupingFormat
-
-
- 8
- left
-
+
+
+ 8
+ Left
+
15
@@ -62,7 +60,7 @@
10
- right
+ Right
@@ -80,7 +78,7 @@
- if (-not $_.PSIsContainer) { [Humanizer.ByteSizeExtensions]::bytes($_.Length).ToString(0.00)}
+ if (-not $_.PSIsContainer) { [Humanizer.ByteSizeExtensions]::bytes($_.Length).ToString(0.00)}
@@ -92,4 +90,4 @@
-
\ No newline at end of file
+
diff --git a/src/formats/FileInfoIcons.format.ps1xml b/src/formats/FileInfoIcons.format.ps1xml
index 48c60c3..7b9a4ce 100644
--- a/src/formats/FileInfoIcons.format.ps1xml
+++ b/src/formats/FileInfoIcons.format.ps1xml
@@ -1,5 +1,4 @@
-
@@ -26,7 +25,7 @@ https://github.com/DHowett/DirColors -->
- $_.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")
+ $_.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")
@@ -54,17 +53,17 @@ https://github.com/DHowett/DirColors -->
7
- left
+ Left
25
- right
+ Right
14
- right
+ Right
@@ -228,4 +227,4 @@ https://github.com/DHowett/DirColors -->
-
\ No newline at end of file
+
diff --git a/src/ps51/System.Buffers.4.0.2.0.dll b/src/ps51/System.Buffers.4.0.2.0.dll
new file mode 100644
index 0000000..b6d9c77
Binary files /dev/null and b/src/ps51/System.Buffers.4.0.2.0.dll differ
diff --git a/src/ps51/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll b/src/ps51/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll
new file mode 100644
index 0000000..e717510
Binary files /dev/null and b/src/ps51/System.Runtime.CompilerServices.Unsafe.4.0.4.1.dll differ
diff --git a/src/public/ConvertTo-Quantity.ps1 b/src/public/ConvertTo-Quantity.ps1
index fe0b724..d9dbd86 100644
--- a/src/public/ConvertTo-Quantity.ps1
+++ b/src/public/ConvertTo-Quantity.ps1
@@ -26,10 +26,10 @@ function ConvertTo-Quantity {
[CmdletBinding()]
[OutputType('string')]
param(
- [Parameter(Mandatory, Position = 0, ValueFromPipeline)]
+ [Parameter(Mandatory, Position = 0)]
[string]$String,
- [Parameter(Mandatory, Position = 1)]
+ [Parameter(Mandatory, Position = 1, ValueFromPipeline)]
[Alias('Count')]
[int]$Quantity,
diff --git a/src/types/TimeSpan.types.ps1xml b/src/types/TimeSpan.types.ps1xml
index e7ee14e..c50158e 100644
--- a/src/types/TimeSpan.types.ps1xml
+++ b/src/types/TimeSpan.types.ps1xml
@@ -7,10 +7,24 @@
Humanize
-
+
-
\ No newline at end of file
+
diff --git a/tests/PowerShellHumanizer.Tests.ps1 b/tests/PowerShellHumanizer.Tests.ps1
index 89821e7..cd6fd52 100644
--- a/tests/PowerShellHumanizer.Tests.ps1
+++ b/tests/PowerShellHumanizer.Tests.ps1
@@ -151,8 +151,8 @@ Describe 'Custom Formats' {
Context 'FileSystem' {
BeforeAll {
- $listAlphaLower = 'a'..'z'
- $listAlphaUpper = 'A'..'Z'
+ $listAlphaLower = [char[]](97..122)
+ $listAlphaUpper = [char[]](65..90)
$listNumber = 0..9
$charset = $listAlphaLower + $listAlphaUpper + $listNumber