xonsh/news
Andy Kipp b19a89b432
Fixed `xonsh -DVAR=VAL` behavior: initiate env variables before shell initialization. (#5396)
### Before

Case 1:
```xsh
xonsh --no-rc --no-env -DCOLOR_OUTPUT 0  # space between -DVAR and VALUE
```
```xsh
Traceback (most recent call last):
  File "/Users/pc/.local/xonsh-env/lib/python3.12/site-packages/xonsh/main.py", line 478, in main
    args = premain(argv)
           ^^^^^^^^^^^^^
  File "/Users/pc/.local/xonsh-env/lib/python3.12/site-packages/xonsh/main.py", line 420, in premain
    env.update([x.split("=", 1) for x in args.defines])
  File "<frozen _collections_abc>", line 987, in update
ValueError: not enough values to unpack (expected 2, got 1)
Xonsh encountered an issue during launch
```
Case 2:
```xsh
xonsh --no-rc --no-env -DXONSH_HISTORY_BACKEND=dummy
history info
# json  # EXPECTED: dummy
```

### After
Case 1:
```xsh
xonsh --no-rc --no-env -DCOLOR_OUTPUT 0
# Wrong format for -DCOLOR_OUTPUT argument. Use -DVAR=VAL form.
```

Case 2:
```xsh
xonsh --no-rc --no-env -DXONSH_HISTORY_BACKEND=dummy
history info
# dummy
```

Closes #5395

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-06 17:39:10 +05:30
..
appimage_py311.rst Downgrade AppImage to 3.11 (#5364) 2024-04-25 11:46:36 +02:00
env_completion.rst Use substring for env completion and better way to sort list (#5388) 2024-05-03 10:30:14 +02:00
fix_process_traceback.rst Fixed empty stacktrace for CalledProcessError (#5391) 2024-05-04 11:50:32 +02:00
jobs_catch_no_process.rst jobs: catching ChildProcessError (#5365) 2024-04-26 10:34:31 +02:00
jobs_repr.rst jobs: default representation changed to dict (#5363) 2024-04-26 10:26:24 +02:00
main_d.rst Fixed `xonsh -DVAR=VAL` behavior: initiate env variables before shell initialization. (#5396) 2024-05-06 17:39:10 +05:30
mini_refactor.rst CommandPipeline: clean repr + a bit of code cleaning (#5369) 2024-05-03 00:09:31 +05:30
no_env.rst feat: add --no-env flag to avoid inheriting parent-shell env (#5370) 2024-04-29 12:29:22 -04:00
popen_name.rst Add thread details to the exception (#5360) 2024-04-24 11:15:40 +02:00
shell_type.rst Shortcut for shell-type (#5367) 2024-04-25 20:10:18 +02:00
subproc_output_format.rst feat: add subproc output format, autostrip singleline output (#5377) 2024-05-02 11:48:25 -04:00
TEMPLATE.rst single instance of string.Formatter 2018-10-20 12:22:59 -06:00
trace_subproc.rst wip 2024-04-26 13:37:19 +05:30
waitpid_returncode.rst Fixed populating the return code for interrupted process. (#5380) 2024-05-02 22:10:53 +02:00
xonfig_env.rst Xonfig: show sensitive env variables that could affect the shell behavior. (#5374) 2024-05-02 22:46:22 +05:30
zulip.rst Xonsh Zulip Community started (#5372) 2024-04-29 10:01:02 -04:00