6 ms·
This is exactly the thing that has always bothered me about PowerShell. A lot of PowerShell's effectiveness derives from the number of nouns that Microsoft has
by nlawalker 7y ago
This is exactly the thing that has always bothered me about PowerShell. A lot of PowerShell's effectiveness derives from the number of nouns that Microsoft has built support for, and a defining trait of any given script is usually the set of nouns it operates over, so it's weird to me that all the commands start with the verb.
- beart 7y agoYes it is really cumbersome to use. Set-<tab> is pretty useless since you have to tab through dozens of entries if you don't know the noun you are looking for.
- jodrellblank 7y agoI don’t know that Verb-Noun is great design but I’m not convinced Noun-Verb would be any better; take your example and get rid of Set- and simply press <tab> right from the start - you have exactly the same problem of dozens of entries if you don’t know the noun you are looking for, changing the order hasn’t improved that, has it? (In reality it’s slightly less clear because tab would then have to show you other file names, executables, batch files, etc. names, at least Set- narrows it down to cmdlets to do with setting).
- oldmanhorton 7y agoBut as other comments have pointed out, Get-Command let's you search by module, noun, or verb. It's certainly not the most intuitive if you're used to normal linear autocomplete, but once you get used to it I find it works well.
- GordonS 7y agoI've never been able to quite put my finger on why I loath Powershell so much, but yes, I think this is part of it. I also dislike how verbose commands are (and the shortened versions are not safe to use cross-platform), and the weird Pascal-Kebab-Casing-Hybrid of idiomatic Powershell also irks me. Still, there is something else... I just don't like it.
- Ididntdothis 7y agoSame here. In theory it could be a great tool and often is but it just doesn’t feel right. I would much prefer if they had done an interpreted version of C# and added the cmdlets to that.
- GordonS 7y agoYep, Powershell is actually really powerful, and even cross-platform with Powershell Core... I wonder if anyone has tried to large-scale "re-skin" it, aliasing command names to make them less verbose and more obvious?
- Ididntdothis 7y agoPowerShell Core is quite nice. I actually used it on my Mac to crunch through a few image files and it worked really well compared to my failed attempts of doing the same with bash.
- pfranz 7y agoI could never get used to PowerShell, but in languages like Bash I /really/ like using short flags in the REPL (for speed), but long flags in scripts (for legibility). Unfortunately, this means there's a higher bar to learn and I've never seen a way to enforce this (I rarely see others use this convention). I hoped PowerShell would address this or the ISE (maybe great autocomplete negates the need for short flags?)
- guhidalg 7y agoDisclosure, I work at MSFT and I have a special place in my heart for PowerShell. PowerShell provides incredibly flexible syntax, enough that it can satisfy most styles of script writing. The practice you describe (short names in CLI and long names in scripts) can be achieved. A couple of things to note about how PS binds arguments to function calls: 1. If you omit names, the parameters are bound positionally. 1. If you use names, you do not have to type the full name. It is sufficient to type an unambiguous prefix of the parameter name and the most appropriate parameter will be selected. So for example in the CLI you can just to `ls -r -fi .csproj` whereas in a script you can use the fully self-documenting `ls -Recurse -Filter .csproj`. Hope this helps!
- Ididntdothis 7y agoTotally agree. PowerShell basically has no discoverability since you have hundred or probably thousands of commands all starting with “Get”. Much better to start with noun or some kind of namespace. “ActiveDirectory-GetUser” is much better than “Get- ActiveDirectoryUser”. Just one of quite a few bad PowerShell design decisions ....
- AcerbicZero 7y agoI know what you mean, but discoverability is the one area where I think Powershell is actually doing pretty well. The Get-Command cmdlet lets you search cmdlets by Module, Verb, Noun, etc, and supports all kinds of wildcards. Plus the built in help (aliased to man) is usually very detailed and provides numerous examples. I think the bigger issue is that MS stuffs all the modules you don't need into every session, so when you want to do something simple against your DHCP server, you also have to tab past all your AD, SAN, NFS, etc, etc cmdlets in the process, which is just dumb.
- stinos 7y agoyou also have to tab past all Or do Ctrl-Enter to get the list of all matches and navigate with arrow keys, should be faster. Thinking of it, I don't really need discoverability often but if I did I'd probably resort to Get-Command | %{$_.Name} | fzf bound to a key or so: this gives you fuzzy matching search of all possible commands. I just tried, 1683 commands in total and this got me all Smb commands in about the amount of time it took me to type 'SMb. It doesn't get better than that. Well, except that you could have fzf split the screen and show the help for each command there. This is also the typical PS (or other shells for that matter) story: people complaining about not being able to do discoverability whle in fact the there are actually some seriously good options but it's those options which are hard to discover :)
- Ididntdothis 7y ago”some seriously good options but it's those options which are hard to discover :)” That’s modern UX for you. Hide features to the degree that only a lucky few will ever find them :). A lot of websites and mobile apps have adopted that philosophy.
- shadowgovt 7y agoThis article has cast light upon the fact for me that this is actually what bothers me about CLIs too; they're useful once you know what can be done, but discoverability is basically "RTFM and good luck."
- edoceo 7y agoIsn't the manual for discovery? Or do you try to use tools w/o instructions? I don't see what the issue is here, reading docs seems like an obvious first step for anything new
- shadowgovt 7y agoGUIs often encourage starting the program, right-clicking on anything, and the menus can give you a decent educated guess at what you can do to that thing. Bonus points if hovering over a menu item pops out an additional summary banner with some more details of the meaning of that menu item. CLIs require matching the flags to the direct objects they apply to and carrying that mapping around in your head (and the command will just fail if you try and apply the wrong flag to the wrong object).
- esoterica 7y agoI think the obvious first step for learning any new command is googling how to do X and clicking in the first stackexchange link.
- cb504 7y agokind of sad.
- AcerbicZero 7y agoPowershell was one of the first scripting languages I actually learned, so I'm a little more forgiving, but I think you've summed up one of the more annoying issues. It seems as Powershell has grown, Microsoft has tried to stuff every module into every session (except the ones you actually need, those you'll inevitably have to import). If Powershell didn't auto import ~30-50 modules, each with 20-200 cmdlets all sharing the same Verb-Noun structure it wouldn't be so bad...except then Windows makes it worse, by making it difficult to limit those modules yourself, and most major updates will notice that you've moved modules around and will happily undo all that work and re-add them. Its still a nice little scripting language, and its awesome when you want to just avoid some Windows GUI nonsense. Plus Powershell's interactive nature makes learning it significantly easier than some of the more complicated languages I've picked up since then, although its getting harder and harder to excuse Microsoft's poor design choices around it.
- dragonwriter 7y ago> it's weird to me that all the commands start with the verb. It's not really weird, (verb)-(direct object)-[(indirect object)] with the subject implied in yh direction of the command is a very common structure for imperative commands in natural language. Given that PS largely targets operators that are not (and even moreso were not when PS was developed) general coders, following natural language imperative patterns makes a lot of sense. There probably is somewhere a natural language that uses object-verb in the imperative, but o haven't heard of one.