Live data from Hacker News

Nushell.sh ls | where size > 10mb | sort-by modified

nushell.sh

61–70 of 215 posts

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#61
post #47

Earlier quoted context omitted.

Cool but that’s as opaque and hard to understand as sacrificing a goat to order ls output. It’s of course possible to do with existing shells, but it’s impossible to argue that it’s a clear

Depends what you’re optimising for. Are you optimising for readability - e.g. maybe you share shell history with team mates for example. Or are you optimising for getting your thoughts transcribed to the machine as quickly as possible. It’s usually this case for me. I tend to maintain a huge shell history so i really like the terse format for quickly filtering down my historical commands. Writing shell scripts might…

I also maintain a huge shell history, but in my experience fzf-ing through it becomes a lot harder when it’s terse and unreadable.

But sure, there’s a tension between readability and brain-to-command throughput that’s always been there.

The way you proposed is a bit too write-only for my taste, and the argument that you “had to learn it and now you’re muscle memory bound to it” is applicable to you only and does not preclude a better way from existing.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#62

[zsh]$ ls -l *(Lm+10om) zsh supports extended globs, this says: -l give me a long listing “*(…)” of any file Lm+10 who’s size “L” in megabytes “m” is greater than 10 “om” ordered by modification ascending

I had no idea Zsh could do that. I'm currently reading this article which explains a lot of this wizardry.

https://thevaluable.dev/zsh-expansion-guide-example/

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#63

Earlier quoted context omitted.

PowerShell isn’t that verbose, compared to NuShell. The ls example would be (with standard PowerShell aliases): gci | where { $_.Length -gt (10 * 1024 * 1024) } | sort LastWriteTime -gt might seem weird, but it’s better than overloading >. (Also, I like the fact that PowerShell is built into Windows and has a large corporation behind it.)

The fact PowerShell has this masochistic tendency to have commands that start with capital case already makes it outside of the realm of consideration for me. It's absolute nonsense. Also I have to say your example is extremely confusing and would probably take quite a bit of time to write IRL. For reference, the equivalent in sh would be: find . -maxdepth 1 -type f -size +10M -exec ls -lt {} + Or a very terse exampl…

Commands aren't case sensitive. Just try it! Tab completion even works if you start the command lowercase.

As for needing to know aliases... Did the knowledge that 'du' stands for 'disk usage' exist in your brain at birth, or did you have to learn it somehow? That criticism is nonsense.

At least with powershell, commands have a canonical, explicit name with standard verbs and nouns; and a short alias that's equivalent to the initial command in every way. What I also like is that parameters have aliases too: you can write - WhatIf or -wi and it'll work the same. And everything is documented.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#64

Earlier quoted context omitted.

Historically we would discourage shell users from cat somefile.txt | whatever and instead tell them to use either whatever or, if the command accepts input file names as arguments then use those like whatever somefile.txt or whatever -i somefile.txt etc But perhaps in fish, “useless use of cat” is not so useless and would be recommended? (I mean aside from the fact that they seem to recommend their “open” command, an…

For some reason I never liked to do it the "right way". First of all it doesn't seem to actually matter. But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift. It also makes it easier to add arguments to the end if re-running it.

>But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift.

Using `out_file`

(Though annoyingly this doesn't work for feeding input to while loops. `< <(echo a; echo b; echo c;) while read -r foo; do echo "$foo"; done` is invalid syntax; it needs to be `while read -r foo; do echo "$foo"; done < <(echo a; echo b; echo c;)`)

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#65

Earlier quoted context omitted.

What about it looks terrible? The braces are necessary, because this is a lambda.

I'd say that $_ is really weird and looks horrible. Also having to do (10 * 1024 * 1024) instead of just writing 10MB is a downgrade even compared to POSIX-compliant sh. In my other comment I've added a few examples in sh, zsh, and a better PowerShell example: gci | ? Length -gt 10MB | sort LastWriteTime

[deleted]

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#66
post #45
post #23

Earlier quoted context omitted.

Sorry but that looks terrible.

I don't mind the looks but I find it hard to debug and have a poor instinct for "does this need a curly bracket or a parens?" That's my real issue with PowerShell, I find it very hard to predict what will work unless I know exactly what the rule is. Shell has similar issues but I've put 20 years into it so the knowledge is there. Every time the PowerShell people describe PowerShell I think "that sounds awesome" but t…

Parentheses are for grouping. Curly brackets are for creating a new script block. If you would have wanted to write "function foo() {}" in another language, go for curly brackets. It's really not that complex.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#67
post #45
post #23

Earlier quoted context omitted.

Sorry but that looks terrible.

I don't mind the looks but I find it hard to debug and have a poor instinct for "does this need a curly bracket or a parens?" That's my real issue with PowerShell, I find it very hard to predict what will work unless I know exactly what the rule is. Shell has similar issues but I've put 20 years into it so the knowledge is there. Every time the PowerShell people describe PowerShell I think "that sounds awesome" but t…

Blocks always use braces. Expressions use parentheses for grouping sub-expressions. It's the same as many C-like languages. I can't imagine any situation where you would be confused which one you need to use.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#69
post #42

Earlier quoted context omitted.

There are plenty of strongly typed memory safe languages. In fact I think those are the majority of popular languages.

I'm not really sure which other popular languages would be considered memory safe AND strongly typed. I know of both C and C++ which I wouldn't consider memory safe. And I know of Javascript, which is not strongly typed... so which do you mean?

Java, Scala, Kotlin, C#, D, Go, and TypeScript to name a few.
Post reply on HN