mirror of
https://github.com/nushell/nushell.git
synced 2025-02-24 14:31:47 +01:00
# Description This PR adds possibility to preserve/strip attributes from files when using `cp` (via uu_cp::Attributes). To achieve this a single `--preserve <list of attributes>` flag is added. This is different from how coreutils and uutils cp function, but I believe this is better for nushell. Coreutils cp has three options `-p`, `--preserve` and `--no-presevce`. The logic of these two options is not straightforward. As far as I understand it is: 1. By default only mode attributes are preserved 2. `--preserve` option adds to default preserved attributes specified ones (e.g. `--preserve=xattr,timestamps` will preserve mode, timestamps and xattr) 3. `-p` is the same as `--preserve=mode,ownership,timestamps` 4. `--no-preserve` option rejects specified attributes (having priority over `--preserve`) However (in my opinion) the `--no-preserve` option is not needed, because its only use seems to be rejecting attributes preserved by default. But there is no need for this in nushell, because `--preserve` can be specified with empty list as argument (whereas coreutils cp will display a `cp: ambiguous argument ‘’ for ‘--preserve’` error if `--preserve` is used with empty string as argument). So to simplify this command is suggest (and implemented) only the `--preserve` with the following logic: 1. By default mode attribute is preserved (as in coreutils cp) 2. `--preserve [ ... ]` will overwrite default with whatever is specified in list (empty list meaning preserve nothing) This way cp without `--preserve` behaves the same as coreutils `cp`, but instead of using combinations of `--preserve` and `--no-preserve` one needs to use `--preserve [ ... ]` with all attributes specified explicitly. This seems more user-friendly to me as it does not require remembering what the attributes preserved by default are and rejecting them manually. However I see the possible problem with behavior different from coreutils implementation, so some feedback is apprecieated! # User-Facing Changes Users can now preserve or reject file attributes when using `cp` # Tests + Formatting Added tests manipulating mode and timestamps attributes. |
||
---|---|---|
.. | ||
nu_plugin_custom_values | ||
nu_plugin_example | ||
nu_plugin_formats | ||
nu_plugin_gstat | ||
nu_plugin_inc | ||
nu_plugin_python | ||
nu_plugin_query | ||
nu-cli | ||
nu-cmd-base | ||
nu-cmd-dataframe | ||
nu-cmd-extra | ||
nu-cmd-lang | ||
nu-color-config | ||
nu-command | ||
nu-engine | ||
nu-explore | ||
nu-glob | ||
nu-json | ||
nu-lsp | ||
nu-parser | ||
nu-path | ||
nu-plugin | ||
nu-pretty-hex | ||
nu-protocol | ||
nu-std | ||
nu-system | ||
nu-table | ||
nu-term-grid | ||
nu-test-support | ||
nu-utils | ||
README.md |
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.