← Back to context

Comment by fainpul

3 days ago

In PowerShell:

  gci -file | sort-object size | select name, size -first 4 | % { $_.size /= 1MB; $_ } | ConvertTo-Json

ConvertTo-Json? What kind of naming convention is that, especially with all the other commands being lowercase?

  • The naming convention is `verb-noun`. It's convenient for discoverability and consistency. The short commands are aliases.

    The last command is properly cased, because I pressed tab (it auto-completes and fixes the case). The other commands I typed without tab completion. You can write however you want, PS is not case sensitive.

i dont think you need to select name and size, you can just remove it and use `select -first 4`, but cool, I never knew about `/=` syntax

  • I was trying to replicate the nushell example, which only has name and size in the output.