nushell
zig
Our great sponsors
nushell | zig | |
---|---|---|
212 | 808 | |
29,485 | 29,799 | |
4.0% | 4.5% | |
9.9 | 10.0 | |
7 days ago | 1 day ago | |
Rust | Zig | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
nushell
- Xonsh: Python-powered, cross-platform, Unix-gazing shell
-
Fish shell 3.7.0: last release branch before the full Rust rewrite
Any thoughts on fish as compared to nushell [0]? It's similar to PowerShell in its philosophy and is also written in Rust.
That or https://www.nushell.sh/ which seems to be more interesting as it could be an equivalent to PowerShell for Unix.
-
jc: Converts the output of popular command-line tools to JSON
> In PowerShell, structured output is the default and it seems to work very well.
PowerShell goes a step beyond JSON, by supporting actual mutable objects. So instead of just passing through structured data, you effectively pass around opaque objects that allow you to go back to earlier pipeline stages, and invoke methods, if I understand correctly: https://learn.microsoft.com/en-us/powershell/module/microsof....
I'm rather fond of wrappers like jc and libxo, and experimental shells like https://www.nushell.sh/. These still focus on passing data, not objects with executable methods. On some level, I find this comfortable: Structured data still feels pretty Unix-like, if that makes sense? If I want actual objects, then it's probably time to fire up Python or Ruby.
Knowing when to switch from a shell script to a full-fledged programming language is important, even if your shell is basically awesome and has good programming features.
-
Ripgrep is faster than {grep, ag, Git grep, ucg, pt, sift}
Maybe if the "popular" shells, but http://www.nushell.sh/ is looking better and better
- "<ESC>[31M"? ANSI Terminal security in 2023 and finding 10 CVEs
-
jq 1.7 Released
Yeah agreed, especially now that PowerShell is available cross-platform.
Nushell[1] also seems like a promising alternative, but I haven’t had a chance to play with it yet.
-
The Case for Nushell
I also discovered an existing discussion[1] related to this topic which includes a link[2] to a "helper to call nushell nuon/json/yaml commands from bash/fish/zsh" and a comment[3] that the current nushell dev focus is "on getting the experience inside nushell right and [we] probably won't be able to dedicate design time to get the interface of native Nu commands with an outside POSIX shell right and stable.".
[0] https://gitlab.com/RancidBacon/notes_public/-/blob/main/note...
[1] "Expose some commands to external world #6554": https://github.com/nushell/nushell/issues/6554
[2] https://github.com/cruel-intentions/devshell-files/blob/mast...
[3] https://github.com/nushell/nushell/issues/6554#issuecomment-...
Today I learned (after disappearing down a rabbit hole after reading the linked article) that it's actually possible to begin to use & benefit from nushell's structured data pipe feature without changing one's current shell.
Structured data pipes have always been my primary reason for keeping an eye on nushell's development but after looking at the project's documentation again today it all still seemed "too much initial effort with uncertain outcome".
Because I don't want to switch my shell (not because bash is good but because it's not a priority to justify the expenditure of effort), I just want to have structured data in pipes within bash!
Turns out it's as easy as:
* nu --commands 'ls | where size > 1MiB'
(Where `nu` is the nushell binary being called from your existing shell prompt.)
Or, as more complete flow of data example:
* echo "[1,2,3]" | nu --stdin --commands 'from json | to json' | cat
Now you can fit nushell within your existing workflow where ever it's useful enough for you--without needing to commit to changing your entire shell.
(And this isn't the only or necessarily the best way to arrange things for the communication with bash--there's "^" & "externals" & "command signatures" & "from ssv" etc too.)
And nushell does have some nifty tools such as `explore` with `:try` to interactively build a processing pipeline.
But this information doesn't seem to be documented anywhere in the "book" or other introductory material. It only seems to be documented in the help message of the `nu` binary--which I almost didn't even get as far downloading today.
But then I found the help text in the source, so decided to try it again: https://github.com/nushell/nushell/blob/fd4ba0443d01e67f6304...
If the structured data pipes is one of the main appeals for you, maybe try this approach out?
zig
-
Zig, Rust, and Other Languages
https://github.com/ziglang/zig/blob/5cd7fef17faa2a40c8da23f0...
Generally speaking, it’s as mentioned just a convention. A zig library might not allow its users to pass allocators for example.
In C++, stl containers can take an allocator as a template parameter. Recent C++ versions also provide several polymorphic allocators in the stdlib. You can also override the global allocator or a specific class’ allocator (override placement new).
-
Nanos – A Unikernel
We need to remove that. We did have a channel on freenode a while back but got rid of it.
Outside of gh discussions there is also https://forums.nanovms.com/. We made a decision a while ago to follow Zig's lead here and have no 'official' community space (https://github.com/ziglang/zig?tab=readme-ov-file#community) instead letting people form their own spaces.
Zig also has an IRC channel on libera (#zig) that is moderated by Andrew Kelley.[1]
- Ask HN: What Underrated Open Source Project Deserves More Recognition?
-
Top Paying Programming Technologies 2024
1. ZIG - $103,611
-
MicroZig: Unified abstraction layer and HAL for Zig on several microcontrollers
ESP32 and STM32 support is very welcome!
I have been following https://github.com/ziglang/zig/issues/5467 for a while and progress seemed to have slowed significantly
-
Asynchronous Clean-Up (in Rust)
I have never used it directly, take what I say with a grain of salt.
As far as I know at least part of the idea was to eliminate the function coloring problem by letting the compiler do some nifty compile-time deductions. This had some issues (I don't know if this is still planned, it seems like the kind of thing that should not work in practice). Additionally, there were all sorts of hard technical issues with LLVM, debugging, etc.
I recommend checking the issue tracker, eg. https://github.com/ziglang/zig/issues/6025
I personally don't understand the domain well enough at all, but honestly, I feel like (if possible) Zig should try to double down on its allocator approach.
Instead of trying to use some compile-time deduction magic explicitly pass around an "async runtime/executor" struct which you explicitly have to interact with. Why not?
-
Show HN: Tokamak – A Dependency Injection-Centric Server-Side Framework for Zig
Atop your readme, you point out that nginx or another reverse proxy should be used. Kudos for that.
As for performance, I'd be curious what gains you get using `std.http.Server` with keepalive and a threadpool. Possibly you can re-use your ThreadContext - having 1 per thread in the threadpool that you can re-using. `std.Thread.Pool` is also very poorly tuned for a large number of small batch jobs, but that's a place to start.
[1] https://github.com/ziglang/zig/blob/b3aed4e2c8b4d48b8b12f606...
Yes, fundamentally. In Rust if you take a parameter of generic type T without any bounds, you cannot call anything on it except for things which are defined for all types. If you specify bounds, only things required by the bounds can be called (+ the ones for all types). Another difference is where you get an error when you try pass something which doesn't adhere to a certain trait. In Rust you will get an error at the call site, not at the place of use (except if you don't specify any bounds).
Zig is doing just fine without any trait mechanism and it simplifies the language a lot but it does come up from time to time. The usual solution is to just get type information via @typeInfo and error out if the type is something you're not expecting [0]. Not everybody is happy about it though [1] because, among other things, it makes it more difficult to discover what the required type actually is.
[0] https://github.com/ziglang/zig/blob/b3aed4e2c8b4d48b8b12f606...
What are some alternatives?
Nim - Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
Odin - Odin Programming Language
v - Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
fish-shell - The user-friendly command line shell.
rust - Empowering everyone to build reliable and efficient software.
elvish - Powerful scripting language & Versatile interactive shell
go - The Go programming language
starship - ☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!
rust - Rust for the xtensa architecture. Built in targets for the ESP32 and ESP8266
ssr-proxy-js - A Server-Side Rendering Proxy focused on customization and flexibility!
PowerShell - PowerShell for every system!
TinyGo - Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.