Stefan Holderbach c9e9b138eb
Improve with-env robustness (#12523)
# Description
Work for #7149

- **Error `with-env` given uneven count in list form**
- **Fix `with-env` `CantConvert` to record**
- **Error `with-env` when given protected env vars**
- **Deprecate list/table input of vars to `with-env`**
- **Remove examples for deprecated input**

# User-Facing Changes

## Deprecation of the following forms

```
> with-env [MYENV "my env value"] { $env.MYENV }
my env value

> with-env [X Y W Z] { $env.X }
Y

> with-env [[X W]; [Y Z]] { $env.W }
Z
```

## recommended standardized form

```
# Set by key-value record
> with-env {X: "Y", W: "Z"} { [$env.X $env.W] }
╭───┬───╮
│ 0 │ Y │
│ 1 │ Z │
╰───┴───╯
```

## (Side effect) Repeated definitions in an env shorthand are now
disallowed

```
> FOO=bar FOO=baz $env
Error: nu:🐚:column_defined_twice

  × Record field or table column used twice: FOO
   ╭─[entry #1:1:1]
 1 │ FOO=bar FOO=baz $env
   · ─┬─     ─┬─
   ·  │       ╰── field redefined here
   ·  ╰── field first defined here
   ╰────
```
2024-04-16 19:08:58 +08:00
..
2022-11-22 16:58:11 -08:00
2023-11-16 15:14:45 -06:00
2023-10-24 12:48:05 -05:00
2024-01-25 14:16:49 +08:00
2024-04-13 14:58:54 +00:00
2024-04-10 06:27:46 +08:00
2023-11-03 10:09:33 -05:00
2024-04-13 14:58:54 +00:00
2023-10-19 09:30:34 -05:00
2023-10-10 03:31:15 +13:00
2024-04-13 14:58:54 +00:00
2024-04-16 19:08:58 +08:00
2023-11-17 19:30:53 -06:00
2024-03-09 18:58:02 +02:00
2023-09-16 21:49:10 +02:00
2023-03-15 18:54:55 +13:00
2024-04-16 19:08:58 +08:00
2023-04-28 13:25:44 +02:00
2023-04-28 13:25:44 +02:00
2024-02-17 10:51:20 +02:00
2023-04-28 13:25:44 +02:00
2024-03-11 19:46:04 +01:00
2023-04-28 13:25:44 +02:00
2024-03-11 19:46:04 +01:00