Home Explore Blog CI



nushell

3rd chunk of `blog/2020-11-03-nushell_0_22.md`
ba99a12a37f4266d77febe3f36ed76f30c189f539ddb2e790000000100000b87


_New flatten command_

There's now a flatten command that can take tables nested inside of the main table and flatten their contents into the main table.

### More `math` commands (morbatex, gillespiecd, fdncred)

You can now use rounding in math operations:

```
> echo [1.5 2.3 -3.1] | math ceil
───┬────
 0 │  2
 1 │  3
 2 │ -3
───┴────

> echo [1.5 2.3 -3.1] | math floor
───┬────
 0 │  1
 1 │  2
 2 │ -4
───┴────

> echo [1.5 2.3 -3.1] | math round
───┬────
 0 │  2
 1 │  2
 2 │ -3
───┴────
```

## Breaking changes

### Remove it-expansion (sophiajt)

Previously, we treated the `$it` variable as a special variable that caused a command to iterate over each element in the row, for example `ls | echo $it.name` would expand to `ls | each { echo $it.name }`.

While this was handy in small examples, in the general case it became confusing to remember when and how it-expansion would happen.

In this release, we're trying an experiment of removing it-expansion.

Previously:

```
ls | echo $it.name
```

Now:

```
ls | each { echo $it.name }
```

Or, you can switch to other forms, like:

```
ls | get name
```

We're working towards a simpler mental model, where blocks can have parameters, and `$it` is the name of the parameter if it's not specified.

Please try it out and let us know what you think.

## Improvements

- **New** - a `seq` command for working with sequences (fdncred)
- bson and sqlite support added to the WiX (fdncred)
- `to md` now has a pretty flag (JosephTLyons)
- `ls` can now support other number formatting (lucassmmg)
- Filesize formats can now be changed via `config` (fdncred)
- Tables can now have heavy or no borders (fdncred)
- `math eval` now supports tau (rjboas)
- `char` now has simpler weather emoji (gillespiecd, fdncred)
- `str to-int` now takes an optional radix for conversion (gillespiecd)
- `char` can now print any unicode character (fdncred)
- `alias` now has optional type inference based on the recently accepted RFC (LhKipp)
- `ls` will also list inode in `-l` mode on Unix (gillespiecd)

## Internal improvements (andrasio, sophiajt, LhKipp, EverlastingBugstopper, JosephTLyons, fdncred, jjshanks)

It's now easier to create column-paths inside of the Nu source, `alias` got some bugfixes, the parser got some bugfixes, fixed typo in the build message, filesize labels for bytes wasn't showing up (now fixed), internally there are now more helpers for creating the core Value type, bumped the required Rust version, bugfix for `;` endings, and remove unneeded comments.

# Looking forward

We're continuing to work to simplify the internal representation, improve the parser, and work to add support for features like block parameters, variables, and, in the future, custom commands.

If you'd like to help out, come by the [discord](https://discord.gg/NtAbbGn) and say hello!

Title: Nushell 0.22: Breaking Changes, Improvements and Looking Forward
Summary
Nushell 0.22 introduces a `flatten` command for flattening nested tables and new math functions like `ceil`, `floor`, and `round`. A breaking change removes the `it-expansion` feature, requiring users to use `each` or `get` for iteration. Improvements include a `seq` command, bson and sqlite support for WiX, `to md` with a pretty flag, enhanced `ls` formatting, customizable filesize formats, table border options, tau support in `math eval`, simpler weather emojis in `char`, optional radix for `str to-int`, unicode character printing with `char`, alias type inference, and inode listing in `ls -l` on Unix. Internal improvements cover column-path creation, alias bugfixes, parser fixes, build message typos, filesize label fixes, Value type helpers, Rust version bump, and semicolon handling. Future plans focus on simplifying the internal representation, improving the parser, and adding support for block parameters, variables, and custom commands.