nushell/crates
Skyler Hawthorne 5886a74ccc
into binary -c: return 0 as single byte (#11068)
# Description

The `into binary` command has a `-c` flag which strips any leading 0s in
the most significant digits to represent the minimal number of bytes,
rather than the system's complete in-memory representation of the input.

However, currently giving 0 as input results in eight 0 bytes even with
the `-c` flag, which is inconsistent with the purpose of the flag.

```nu
❯ : 345678 | into binary
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   4e 46 05 00  00 00 00 00                             NF•00000

❯ : 345678 | into binary -c
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   4e 46 05

❯ : 0 | into binary
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   00 00 00 00  00 00 00 00                             00000000

❯ : 0 | into binary -c
Length: 8 (0x8) bytes | printable whitespace ascii_other non_ascii
00000000:   00 00 00 00  00 00 00 00                             00000000
```

This change fixes this behavior so that if the entire input results in
all 0 bytes, only a single 0 byte is returned.

```nu
❯ : ~/src/nushell/target/aarch64-linux-android/debug/nu -c '0 | into binar
y -c'
Length: 1 (0x1) bytes | printable whitespace ascii_other non_ascii
00000000:   00
```

# User-Facing Changes

Values which result in all null bytes will be truncated to a single byte
when `-c` is given. This could potentially be considered a breaking
change if this behavior was relied upon in some way.
2023-11-16 04:09:31 -06:00
..
nu_plugin_custom_values Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_example Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_formats Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_gstat Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_inc Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu_plugin_python remove vectorize_over_list from python plugin (#9905) 2023-08-03 16:46:48 +02:00
nu_plugin_query Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cli Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-base Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-dataframe Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-extra Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-cmd-lang Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-color-config Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-command into binary -c: return 0 as single byte (#11068) 2023-11-16 04:09:31 -06:00
nu-engine Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-explore nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-glob Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-json Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-lsp Implement LSP Text Document Synchronization (#10941) 2023-11-15 17:35:48 -06:00
nu-parser Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-path Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-plugin Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-pretty-hex Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-protocol nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-std Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-system Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-table nu-table/ Add -t/theme argument && Replace -n/start-number with -i/index (#11058) 2023-11-15 17:41:18 -06:00
nu-term-grid Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
nu-test-support Testing support tweaks: exit status in Outcome (#10692) 2023-11-15 23:50:43 +01:00
nu-utils Bump version to 0.87.1 (#11056) 2023-11-15 23:50:11 +01:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

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.