Utils/Remove-ExcessWhitespace.ps1

# =============================================================================
# Created on: 6/8/2018 @ 17:48
# Created by: Alcha
# Organization: HassleFree Solutions, LLC
# Filename: Remove-ExcessWhitespace.ps1
# =============================================================================

<#
.DESCRIPTION
  Removes the excess whitespace from a given script so there's no random whitespace throughout the file.
 
.SYNOPSIS
  Remove excess whitespace from a given script.
 
.PARAMETER Directory
  The directory containing the scripts you wish to modify.
#>

function Remove-ExcessWhitespace () {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true,
                   Position = 0)]
        [ValidateNotNullOrEmpty()]
        [Alias('Dir')]
        [System.IO.FileInfo]$Path
    )
    
    if (Test-Path -Path $Path) {
        $Content = Get-Content -Path $Path -Raw
        $Content
    }
}