mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 23:37:48 +02:00
Make config.filesize_format
/config.filesize_metric
conflict resolution consistent (#7410)
# Description Currently, `filesize_format`/`filesize_metric` conflicts are resolved as follows: if the `filesize_format` ends in "ib", then that overrides `filesize_metric`, otherwise, `filesize_metric` overrides `filesize_format`. This removes this difficult-to-predict asymmetric behaviour, and makes it so that `filesize_metric` always overrides `filesize_format`. This also adds tests for `$env.config.filesize.format` and `$env.config.filesize.metric` values. REMINDER: `filesize_metric` means "increments of 1000", and refers to KB-MB-GB-TB etc. # User-Facing Changes See above. # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
@ -101,7 +101,7 @@ fn format_value_impl(val: &Value, arg: &Arguments, span: Span) -> Value {
|
||||
match val {
|
||||
Value::Filesize { val, span } => Value::String {
|
||||
// don't need to concern about metric, we just format units by what user input.
|
||||
val: format_filesize(*val, &arg.format_value, false),
|
||||
val: format_filesize(*val, &arg.format_value, None),
|
||||
span: *span,
|
||||
},
|
||||
other => Value::Error {
|
||||
|
Reference in New Issue
Block a user