I was going to say: Cue Blakeyrant, but i was too slow.
Not that i disagree with him in this case (rare, i know, but it does happen) the CLI sucks.
however it can't be fixed because of the billions of lines of scripts that rely on the command line acting the way it does (i'm counting all CLIs here, bash, BAT, sh, powershell, etc)
if we fix the CLI, even putting aside the retraining effort required for humans, we literally could not afford the cost of rewriting all those scripts to use the fixed CLI. So we're stuck with it.
and when you show me a perfectly automatable UI that just works, even when the UI is redesigned, changed, or customized.. well then i'll show you a Strong AI, because that's what it would take.
the CLI may be terrible to the point of being broken, but it's there, it is scriptable perfectly, and... well yeah. It sucks but it sucks less than trying to write all those scripts to automate the UI.