Hacker News new | ask | show | jobs
by jodrellblank 2498 days ago
At the interactive shell, the verbosity collapses:

    ipcsv $src|group column8|%{$_.group|epcsv "$dstdir\$($_.name).csv" -noty -e ascii -v}
The bad part is when writing "good" powershell the verbosity is exponentially worse and it turns into

    try
    {
        if (-not [string]::IsNullOrEmpty($_.Column8))
        {

            $fullPathName = Join-Path -Path $dstDir -ChildPath $_.Column8
            $pathTestResult = test-path -LiteralPath $fullPathName -ErrorAction Stop


            # This is a hashtable of the parameters to a cmdlet
            # the only purpose of this 'splatting' is that
            # powershell commands get too long
            # and can't be line-wrapped in any good way

            $exportParams = @{
                Encoding = 'ASCII'
                NoTypeInformation = $true
                Append = $true
                LiteralPath = $fullPathName
                Verbose = $true
            }

            Export-Csv $exportParams
        }
    }
    catch [whatever]
    {
        
    }
and on and on and on, ugh.