Hacker News new | ask | show | jobs
by zilchers 2498 days ago
I'd say the counter example to this is Powershell - if you've ever used it, it's quite verbose and can be less than pleasant to write. I think having both options is the best, when you're getting started it's nice to have verbose, highly self explanatory commands. As you get more familiar with the environment, it's nice to move to something more concise.

Import-Csv -Path $src | foreach { $file = $_.column8 Write-Verbose "Writing to $file" Export-Csv -Path (Join-Path -Path $dstDir -ChildPath "$($file).csv") -InputObject $_ -Append -Encoding ASCII -NoTypeInformation

1 comments

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.