3 ms·
It's also just absurdly verbose for a language intended mainly for manual input. I get annoyed having to type out `sudo systemctl` multiple times in a row, in P
by xelamonster 2y ago
It's also just absurdly verbose for a language intended mainly for manual input. I get annoyed having to type out `sudo systemctl` multiple times in a row, in Powershell every single command is at minimum that long. Which makes it way more difficult to memorize the commands too.
- Vegenoid 2y agoIMO, getting comfortable with and tuning autocomplete makes this a non-issue, and the benefit of the verbose commands is that they are very discoverable.
- rustyminnow 2y agoAny tips or links for tuning? zsh has a powerful engine and lots of great work out there, but when I've tried cooking my own it's all just too dense to get "comfortable" for long.
- WorldMaker 2y agoFor VS Code there is a good first-party PowerShell extension which helps a lot at writing scripts in the verbose style. There's experimental new IntelliSense available in the VS Code terminal: https://code.visualstudio.com/docs/terminal/shell-integration#_experimental-intellisense-for-powershell https://code.visualstudio.com/docs/terminal/shell-integratio...
- WorldMaker 2y agoThere are ton of aliases. It's "impolite" [0] to use aliases in scripts and documentation so looking at PowerShell examples is way more verbose than actually using it day to day in a REPL. Sure I could write `Set-Location` a million times a day, but I just use `cd` in the old ways. Same with `Get-ChildItem`, I tend to just use `ls` myself because of ancient habits. (I find it interesting how many have been moving to `gci` instead as the more PowerShell-native `ls` alias. I've not been convinced to do that myself, but I think it has to do with `gci` is way more powerful than most shells' `ls` and is used to navigate everything from folder structures to object structures including that its not a bad `jq` if you convert JSON files to PowerShell objects.) [0] It's from a version of the Python ethos that code is read way more often than it is written, so when you are polishing PowerShell code to share with others you expand all the aliases so that it is easier to read.
- frenchyatwork 2y agoWhat about the part of the Python ethos where "There should be one-- and preferably only one --obvious way to do it"
- WorldMaker 2y agoA) PowerShell isn't Python, it doesn't have to (and doesn't) import the whole Python ethos, just the parts that make sense for a Shell and Shell language with different end goals. B) PowerShell doesn't care as much about the first part because shells have always had aliases and macros, but it does care about the second half "obvious way to do it". The other reason for starting with verbose names and aliasing them for day to day REPL use is to aid discovery. It's often very easy to discover which command or cmdlet does the thing you need simply because it is right there in the name. Sometimes you can just guess the name because there are only so many "allowed" verbs and you just need the noun you want to "verb". `Get-Help` can be quite powerful, `Get-Verb` can help explain some bits about what the verbosity is meant to mean. You can search for commands with `Get-Command`.
- nerdponx 2y agoPython itself doesn't follow that at all, ignore it.
- xelamonster 2y agoUsing a different set of commands in the terminal versus scripts and documentation makes no sense to me, why would I want to learn two different ways do the same thing? Python does not expect me to use `open` in the REPL but prefer `get_file_handle` in published scripts, their ethos works because the entire language has an emphasis on relatively concise readability. Every single command starting with `Get-` or `Set-` adds so much noise and makes things really hard to visually distinguish too. I don't want overly verbose commands in scripts for the same reason I don't want them in the terminal, it's still a pain to write and even if you have some autocomplete it makes editing harder. I don't think `ls` is any less clear or harder to learn than `Get-ChildItem` really, that name doesn't even actually give me any clue what the command does.
- emmelaich 2y agoDo you know that there are short versions? e.g. gc for Get-Content
- abhinavk 2y ago> sudo systemctl Make an alias like sctl. Takes 5 seconds. Or an abbr if you are using fish. They are more like text-expanders than aliases.
- 7bit 2y agoReally? I only have to remember Item instead of touch, mkdir, RM, rmdir, cp, mv. All commands that have just different verbs before the Noun in Powershell. And that's for every single cmdlet out there. It sounds to me that you're unfairly putting your existing knowledge about Linux shells into your criticism of PowerShell. If you want to be fair that criticism should come from the POV of someone who does not now both and now wants to memorise it. And whether or not commands are short or long does not matter. People memorise lyrics, or names of hundreds of people. Length is not a factor, objectively. And alias do exist.