Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
New Release v1.0.11 !deploy (#22)
Browse files Browse the repository at this point in the history
- Renamed Convert-StringToShort to Convert-ToShortString
- fixed output value return
  • Loading branch information
MauRiEEZZZ authored Oct 6, 2020
1 parent 8fb14ba commit 003a239
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Public/3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
51 changes: 51 additions & 0 deletions src/Public/Convert-ToShortString.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function Convert-ToShortString {
<#
.SYNOPSIS
returns an abreviate from the string you provide, try to get a 3 letter word
.EXAMPLE
PS> Get-ShortEnvironment -StringInput 'Test'
tst
PS>_
.PARAMETER StringInput
The string of the text file you'd like to make shorter
If the word your provide is a well known one I try to make the best of it
#>
[CmdletBinding()]
param (
# this where you provide the string
[Parameter(Mandatory = $true, ValueFromPipeline)]
[string]$StringInput
)

begin {
# we do nothing here noting to initialise
}

process {
if($StringInput.Length -gt 3 )
{
Switch ($StringInput)
{
"development"{ return "dev" }
"production"{ return "prd" }
"prod" { return "prd" }
"testing" { return "tst" }
"test" { return "tst" }
"staging" { return "stg" }
"testing" { return "tst" }
"acceptance"{ return "acc" }
default { return ($StringInput.ToLower() -replace '[aeiouy]').SubString(0,3) }
}
}
else
{
return $StringInput.ToLower()
}
}

end {
# we do nothing here noting to cleanup
}
}

0 comments on commit 003a239

Please sign in to comment.