Skip to content

Commit

Permalink
write the "making nushell better" section
Browse files Browse the repository at this point in the history
this commit removes
| author        | description                                                | url                                                     |
| ------------- | ---------------------------------------------------------- | ------------------------------------------------------- |
| @kubouch      | Add NU_VERSION environment variable on startup             | [#10177](nushell/nushell#10177) |
| @mastermach50 | changed default env file to use $nu.home_path to find home | [#10192](nushell/nushell#10192) |
| @amtoine      | support tab completion cycling                             | [#10199](nushell/nushell#10199) |

because i'm not sure they are as interesting as the conditional sourcing
and the accessibility with screen reader friendly errors.
  • Loading branch information
amtoine committed Sep 17, 2023
1 parent cceeb01 commit c6b96e7
Showing 1 changed file with 58 additions and 11 deletions.
69 changes: 58 additions & 11 deletions blog/2023-09-19-nushell_0_85_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,64 @@ to make the command less easy to understand in [#10258](https://github.com/nushe
Thanks to him again, one can now quit the `explore`r by hitting any of `ctrl+c`, `ctrl+d` or `ctrl+q`
(see [#10257](https://github.com/nushell/nushell/pull/10257)).

## making Nushell easier and better to live in
<!-- TODO: complete the section -->
| author | description | url |
| ------------------ | ------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| @kubouch | Allow parse-time evaluation of calls, pipelines and subexpressions | [#9499](https://github.com/nushell/nushell/pull/9499) |
| @kubouch | Allow parse-time evaluation of `if` | [#10326](https://github.com/nushell/nushell/pull/10326) |
| @JoaquinTrinanes | Screen reader-friendly errors | [#10122](https://github.com/nushell/nushell/pull/10122) |
| @kubouch | Make $nu constant | [#10160](https://github.com/nushell/nushell/pull/10160) |
| @kubouch | Add NU_VERSION environment variable on startup | [#10177](https://github.com/nushell/nushell/pull/10177) |
| @MasterMach50 | changed default env file to use $nu.home_path to find home | [#10192](https://github.com/nushell/nushell/pull/10192) |
| @amtoine | support tab completion cycling | [#10199](https://github.com/nushell/nushell/pull/10199) |
## Making Nushell easier and better to live in
### Conditional sourcing and much more
The Nushell core team has been asked quite a lot of times to be able to do parse-time conditional
`source`ing` or `use`ing in the configuration, e.g. to load different things depending on the system:
```nushell
if $nu.os-info.name == "windows" {
source "my_windows_config.nu"
} else {
source "my_unix_config.nu"
}
```

This was not possible until the excellent work proposed by [@kubouch](https://github.com/kubouch):
- in [#9499](https://github.com/nushell/nushell/pull/9499), he made the evaluation of many Nushell
structures possible at parse-time, given that arguments and commands are all constants
- with [#10326](https://github.com/nushell/nushell/pull/10326), `if` is now a valid parse-time
constant structure
- finally, [#10160](https://github.com/nushell/nushell/pull/10160) makes the `$nu` built-in variable
a true constant :partying_face:

What does this all mean? That one can now write something very similar to the proposed snippet above!
```nushell
const WINDOWS_CONFIG = "my_windows_config.nu"
const UNIX_CONFIG = "my_unix_config.nu"
const ACTUAL_CONFIG = if $nu.os-info.name == "windows" {
$WINDOWS_CONFIG
} else {
$UNIX_CONFIG
}
source $ACTUAL_CONFIG
```

### Improving accessibility
Up until now, an issue for users using a screen reader was that Nushell errors and tables are quite
fancy with some unicode characters.
The issue is that screen reader might have trouble reading them, making the understanding of what's
going on the REPL very hard...

For tables, it's quite easy, you can set `$env.config.table.mode` to something like `"basic"` or
`"none"` and you should be good!
But errors remained fancy
```nushell
Error: nu::shell::external_command
× External command failed
╭─[entry #4:1:1]
1 │ foo
· ─┬─
· ╰── did you mean 'for'?
╰────
help: No such file or directory (os error 2)
```

[@JoaquinTrinanes](https://github.com/JoaquinTrinanes) did implement screen reader-friendly errors
in [#10122](https://github.com/nushell/nushell/pull/10122) which will hopefully make the experience
a lot better when it comes to errors.

## More support for more platforms
In this release, [@dead10ck](https://github.com/dead10ck) made it possible to use Nushell in Termux
Expand Down

0 comments on commit c6b96e7

Please sign in to comment.