Skip to content

$env does not apply in some situations where it should #10175

@dupdrop

Description

@dupdrop

Describe the bug

The following snippet is expected to set $env.config.table.mode = none for the scope of the do block:

# either this
do { $env.config.table.mode = none; ls }

# or this
with-env {config: {table: {mode: none}}} { ls }

In practice ls here is not working as expected, it does not use the 'none' configuration.

Replacing ls with print (ls) does print the expected results, but I don't understand why.

Replacing ls with echo $env.config.table.mode does print the expected result (none).

In addition, but not exactly related: The output of table --help for table --list does not tell you where/how you can use the
results from table --list. Especially since I just wanted to test it ad-hoc and not actually change my config.nu (The mode setting there looks pretty obvious, but I didn't even look there)

How to reproduce

  1. Run do { $env.config.table.mode = none; ls }
  2. See the outputted table is not shown in the expected mode/theme.

Expected behavior

I expect nu to use the set configuration inside the do block.

Screenshots

No response

Configuration

key value
version 0.84.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.71.0 (8ede3aae2 2023-07-12)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.71.0 (cfd3bbd8f 2023-06-08)
build_time 2023-08-26 17:04:51 +03:00
build_rust_channel release
allocator standard
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

Metadata

Metadata

Assignees

Labels

A:configurationIssue related to nu's configurationA:table-rendererIssues about the table renderercategory:bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions