6 ms·
Nushell 0.60 Released
- blakesterz 5y agoI love that first paragraph! I have no idea what Nu is going in, but all it took was 2 sentences and I'm up to speed. "Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines." So often there's link to some new release of something and I have no idea what it does. I'm not sure why more projects don't start with an explanation of what that project is/does!
- deleted 5y ago[deleted]
- ripley12 5y agoThis is a massive release; congratulations to the Nu team for replacing the engine, line editor, and more. Nu isn't quite 1.0 yet but this is the first release I can see using as my daily driver. There are a few rough edges and things aren't 100% stable yet, but I'm really impressed by the overall level of polish. Using Nu is like a glimpse into a future where string parsing is largely a thing of the past. I've been helping out a bit with the documentation; if you have questions about getting started with Nu or if anything in the docs is unclear, let me know! https://www.nushell.sh/book/ https://www.nushell.sh/book/
- svnpenn 5y agoHow to disable hints?
- ripley12 5y agoWhat hints are you looking to disable?
- majkinetor 5y agoI am PowerShell user for decade+ and this is the first time I am actually excited about Nushell. This release is awesome.
- zkldi 5y agoBeen using this for a while now. It's very good, well designed and the right way (imo) to modernise the shell. Bringing datastructures to the shell environment (instead of everything being strings) is just the right thing to do, and I've been personally interested in making binaries that can natively input/output these data structures. big thanks to the team, this stuff is cool.
- kzrdude 5y agoHave they found the right way to be inclusive of and handling old-style tools that only in/output text? That's usually a deciding factor in how improvements and new systems gain traction - that they are possible to introduce gradually and they deal with all existing programs.
- ripley12 5y agoI think it's pretty good. It's easy to pipe text-speaking tools into Nu pipelines, and there's a built-in `lines` command that will split line-break-delimited text into a list of strings. From there you can use lots of tools to operate on each line. Going from Nu data structures to raw lines of text is a little clumsier (`str collect (char newline)` IIRC) but I think that will get improved soon enough. There's also a handy `detect columns` command that does a pretty good job of automatically converting text tables from old *nix/Windows tools into Nu tables.
- majkinetor 5y agoScreams for -join operater.
- bhedgeoser 5y agoYou need to write a plugin in rust. The builtin scripting language isn't that good.
- vlmutolo 5y agoIn the article, they show how you can use any language to write a plugin.
- zamalek 5y agoDoes anyone use this with nix/home-manager? I'd love to try this, but it looks like there would be struggles sourcing the nix daemon?
- ejplatzer 5y agoI'm not sure about home-manager, but I've been using Nushell as my daily-driver with nix on Macos for almost a month now. This new release will make the integration with nix even easier. Basically, instead of sourcing the nix.sh script in your shell config file (.bashrc or equivalent), you manually add the two significant nix directories to your path in the Nu config file. The Nix Manual[1] explains what the nix.sh script does: "To use Nix, some environment variables should be set. In particular, PATH should contain the directories prefix/bin and ~/.nix-profile/bin." So it's as easy as adding those to your path in the config file, which in Nu looks like `let-env PATH = [...other path elements, "path/to/home/dir/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"]`. [1] https://nixos.org/manual/nix/stable/installation/env-variables.html https://nixos.org/manual/nix/stable/installation/env-variabl...
- zamalek 5y agoThanks! I'll definitely check out Nu tomorrow.
- pie_flavor 5y agoI love the concept but I can't see myself using this regularly unless they really hammer out a lot more stdlib. This might be a lot less noise than powershell but powershell still has all of .NET accessible to its scripts.
- jayd16 5y agoI wonder if nushell could also use dotnet in a similar way, considering PowerShell has already done the work.
- ripley12 5y agoI feel like I'm the main audience for PowerShell (.NET is my primary tech stack) but I could never get into it. Using .NET in PowerShell always felt really awkward+slow (like, the one time I embedded some C# in my profile it made PowerShell startup way slower). Do you have any tips for using .NET from PowerShell?
- majkinetor 5y agoNot sure what is your problem here. The code is almost the same as in C# most of the time (not embedding C#, writing equivalent pwsh code). On the other hand, in 10+ years using it I had to use C# inside no more then couple of times. Accessing other stuff via native calls (such as [DateTime]::Now or [string]::IsEmptyOrWhiteSpace) is more common.
- abdusco 5y agoYou should not be using the Powershell that comes bundled with Windows. It's slow and only updated with major system upgrades. Install the open source version: `dotnet install powershell`. Having said that, Powershell suffers from the same problem as .NET: slow startup. It's improved massively in the last few versions and I think it will get even faster once it's built using NativeAOT in .NET 7. But it can also never be as fast as .NET, since it's interpreted. So there's that.
- ripley12 5y ago
- vsroy 5y agoCan anyone who has used nushell for a while comment on pros/cons?
- asoneth 5y agoI'm very curious to hear from the folks who have used Nu as a daily driver. Besides the initial relearning costs and the rough edges to be expected from work-in-progress software, have you run into downsides compared to shells like Bash or Fish?
- thayne 5y agoI haven't switched to it as my daily driver (yet) because of some downsides. Several are addressed in this release, but there are still a few features that aren't there yet including: - no support for background tasks, or resummoning stopped processes - while completion was added in 0.60, it doesn't look quite as featureful as zsh completion, and of course it doesn't have as many completions written as older shells - less common need, but I don't think there is a way to do something like `exec {myvar}>file` - I don't think there is an equivalent of `<(command)` to pass the output of a command to another command as a file. Although that could probably be implemented as a plugin pretty easily.
- ripley12 5y ago> I don't think there is a way to do something like `exec {myvar}>file` I might be misunderstanding this, but piping to `save` is how you usually redirect to a file in Nu: https://www.nushell.sh/book/commands/save.html https://www.nushell.sh/book/commands/save.html
- thayne 5y ago`exec {myvar}>file` will open a file descriptor that can write to `file`, and then store that file descriptor in the variable `$myvar`, so you can then redirect additional commands to it with `>$myvar` or `>>$myvar`. From the bash man page: > Each redirection that may be preceded by a file descriptor number may instead be preceded by a word of the form {varname}. In this case, for each redirection operator except >&- and <&-, the shell will allocate a file descriptor greater than or equal to 10 and assign it to varname. If &- or <&- is preceded by {varname}, the value of varname defines the file descriptor to close. If {varname} is supplied, the redirection persists beyond the scope of the command, allowing the shell programmer to manage the file descriptor himself.
- ryukoposting 5y agoGiving this a favorite, so I remember to come back to it later. I don't know if I need (or want) yet another shell, but this looks cool enough to at least merit a try.
- davidawad 5y agoI appreciate how much time this probably took. I've used it a few times and I'm a huge fan.
- wodenokoto 5y agoSo a while ago I had this idea (which probably everybody has had) to make a shell that passes structured data, like lists or tables around. And then, just like how everybody writes complex completion scripts for all sorts of command line tools, build parsing wrappers around legacy tools, so you don’t need to rewrite git and company. Is that what Nushell is in a nutshell?
- southerntofu 5y agoYes, mostly. It has a lot of shell built-ins and a plugin interface so you don't need to manually parse everything, though. I think it really clicked for me when i read somewhere in an example `ls | sort-by size` and `ls | where size > 100mb`. They are both simple operations that i cannot accomplish from memory using standard POSIX tools, yet one year later i can remember the nushell example very well.
- xolve 5y agoI have been using nushell on Windows for a long time. It has a feel similar to Linux shell and yet it runs natively on Windows. This release is definitely a huge bump and really appreciate how shiny it is.
- orf 5y agoI really like the idea of Nushell. > /Users/tom> ps | grep "k9" Unsupported: Row(Dictionary { entries: {"pid": Value { value: Primitive(Int(359)), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }, "name": Value { value: Primitive(String("backupd-helper")), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }, "status": Value { value: Primitive(String("Unknown(0)")), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }, "cpu": Value { value: Primitive(Decimal(BigDecimal("0.000000000000000"))), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }, "mem": Value { value: Primitive(Filesize(0)), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }, "virtual": Value { value: Primitive(Filesize(0)), tag: Tag { anchor: None, span: Span { start: 3, end: 5 } } }} }) error: Received unexpected type from pipeline (row) ┌─ shell:2:6 │ 2 │ ps | grep "k9" │ ^^^^ expected a string, got row as input I understand what happened here, but sometimes I really want to just grep through stuff. It's not clear how to do this and there isn't much in the docs about it. Without this I'm not sure I could actually switch.
- ripley12 5y agoHi, the `find` command is probably easiest: https://www.nushell.sh/book/commands/find.html https://www.nushell.sh/book/commands/find.html ps | find k9 That will search through every column in the `ps` results. If you want to look through just the name column: ps | where name =~ k9
- nerdponx 5y agoIs there a command to string-ify the input so that you can use standard Unix coreutils, etc. on it? This was always my big annoyance with Powershell too, the shell builtins and functions were powerful, but interacting with "dumb" old-style programs that expect and emit streams of text was cumbersome. Also, is `ps` here a wrapper or shell builtin? Or is Nushell actually parsing the output from the `ps` program?
- ripley12 5y agops is a shell builtin in Nu (and you can check that with `which ps`). Going from Nu to raw text is currently a little awkward. `str collect (char nl)` will take a Nu list of strings and convert it to raw text with line breaks. I suspect we'll get a more ergnomic way to do this soon. Going to Nu from raw text is nicer, the built-in `lines` command splits line-break-delimited text into a list of strings. From there you can use lots of Nu tools to operate on each line.