mirror of
https://github.com/nushell/nushell.git
synced 2025-07-09 19:07:16 +02:00
# Description This PR makes the last specified CLI arguments take precedence over the earlier ones. Existing command line tools that align with the new behaviour include: - `neovim`: `nvim -u a.lua -u b.lua` will use `b.lua` - `ripgrep`: you can have `--smart-case` in your user config but override it later with `--case-sensitive` or `--ignore-case` (not exactly the same flag override as the one I'm talking about but I think it's still a valid example of latter flags taking precedence over the first ones) I think a flag defined last can be considered an override. This allows having a `nu` alias that includes some default config (`alias nu="nu --config something.nu"`) but being able to override that default config as if using `nu` normally. ## Example ```sh nu --config config1.nu --config config2.nu -c '$nu.config-path' ``` The current behavior would print `config1.nu`, and the new one would print `config2.nu` ## Implementation Just `.rev()` the iterator to search for arguments starting from the end of the list. To support that I had to modify the return type of `named_iter` (I couldn't find a more generic way than `DoubleEndedIterator`). # User-Facing Changes - Users passing repeated flags and relying in nushell using the first value will experience breakage. Given that right now there's no point in passing a flag multiple times I guess not many users will be affected # Tests + Formatting I added a test that checks the new behavior with `--config` and `--env-config`. I'm happy to add more cases if needed # After Submitting
Nushell core libraries and plugins
These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.
Foundational libraries are split into two kinds of crates:
- Core crates - those crates that work together to build the Nushell language engine
- Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.
Plugins are likewise also split into two types:
- Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
- Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.