PowerShell's problem is it's so goddamn wordy and poorly documented. It reminds me of AppleScript, but far worse.
I wouldn't go that far :-). But you are right. They did good work with the cmdlets but they put a terrible language on top of them.
It would have been much better if they had put an interpreted version of C# (maybe with a few extensions) on top of it.
F# will even compile
let add a b = a + b
add 1 2;;
as val add : a:int -> b:int -> int
val it : int = 3
or let add a b = a + b
add 1ul 2ul;;
as val add : a:uint32 -> b:uint32 -> uint32
val it : uint32 = 3u
So it will even infer type from the first usage of the function.Edit: The side benefit of the verbosity is the discoverability of less used commands. Is it groupadd or addgroup? No question in Powershell, it would be Add-Group because of the Verb-Noun standard. Bash has all sorts of inconsistencies that require look-up if you don't use those commands often.
get-command add*group*
Or for brevity gcm add*group*
For reference, the Bash version is this: compgen -c | grep group
Edit:Let's get crazier. You want custom tab completion to focus on the command's noun plus Bash style completion.
$Function:OriginalTabCompletion = $Function:TabExpansion
function TabExpansion($line, $lastWord) {
if ($line -match ('^!(.*)') {
$lastWord = $lastWord.trimstart('!')
Get-command -noun *$lastWord*
} elseif {
OriginalTabExpansion $line $lastWord
}
}
Set-psreadline -chord tab -function MenuComplete
!group<TAB>Oh hell.