To alias, or not to alias, or to imply an alias (or Function)The difference between Help and Get-Help was raised in the discussion portion of this months Saturday PowerShell SIG. I had always assumed that Help was just an alias for Get-Help, and was happily ignorant.
Help Vs. Get-Help
This isn't really an alias, it is a function that can be seen with:
get-item function:Help | select -expand ScriptBlock
For example a PS3.0 install with the PSCX module installed gives:
Without PSCX in PowerShell 2.0 the same Command generates:
Help is not an alias, it is a function in both installs. People treat these as interchangeable in many online references that I have seen. For most part they are, but they are not the 'same' and this distinction may impact learning.
Get-Alias -Definition Get-ChildItem
CommandType Name ModuleName
----------- ---- ----------
Alias dir -> Get-ChildItem
Alias gci -> Get-ChildItem
Alias ls -> Get-ChildItem
If you mix these alias with full cmdlets you can have 4 completely correct answers. If you are trying to learn the Verb-Noun pairing of PowerShell you could completely miss it. The Verb-Noun pairs are also often referenced as key learning and exploring benefit of PowerShell.
So what could we do to completely overreact to this information?
- We could wipe out all of alias:\* and all function:\* that don't contain a hyphen (-). We would probably not be able to run many other scripts though. Not sure what this would break actually. I could only see it as really helping in a high-wire style class room setting.
- Run a Function to open a PS1, or ISE and expand aliases. Something like: http://PoshCode.org/embed/2980
- Improve visibility into what you write and echo an expanded version of the last thing you typed in expanded form. While at it, expanding any ordered or trimmed argument names would be good too (not show below).