diff --git a/lib/core/tools.psm1 b/lib/core/tools.psm1 new file mode 100644 index 0000000..de43c34 --- /dev/null +++ b/lib/core/tools.psm1 @@ -0,0 +1 @@ +Import-IcingaDirectoryModules -LibDirectory (Join-Path -Path $PSScriptRoot -ChildPath $MyInvocation.MyCommand.Name) -ForceReload; diff --git a/lib/core/tools/New-StringTree.psm1 b/lib/core/tools/New-StringTree.psm1 new file mode 100644 index 0000000..43e06d7 --- /dev/null +++ b/lib/core/tools/New-StringTree.psm1 @@ -0,0 +1,19 @@ +function New-StringTree() +{ + param( + [int]$Spacing + ) + + if ($Spacing -eq 0) { + return ''; + } + + [string]$spaces = ' \_ '; + + while ($Spacing -gt 1) { + $Spacing -= 1; + $spaces = ' ' + $spaces; + } + + return $spaces; +} diff --git a/lib/core/tools/Test-Numeric.psm1 b/lib/core/tools/Test-Numeric.psm1 new file mode 100644 index 0000000..8d3fca9 --- /dev/null +++ b/lib/core/tools/Test-Numeric.psm1 @@ -0,0 +1,3 @@ +function Test-Numeric ($number) { + return $number -Match "^[\d\.]+$"; +}