Skip to content

Commit

Permalink
Release notes changes for 0.100.0 (#1627)
Browse files Browse the repository at this point in the history
* Continue release notes

* Finish PRs and changes
  • Loading branch information
IanManske authored Nov 13, 2024
1 parent dea650c commit 9aaaa7a
Showing 1 changed file with 172 additions and 10 deletions.
182 changes: 172 additions & 10 deletions blog/2024-11-12-nushell_0_100_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,33 @@ We wish to express our heartfelt gratitude and congratulations to all of our con

With [#14072](https://github.com/nushell/nushell/pull/14072), this release adds two "new" operators: `like` and `not-like`. These operators are alternative forms of the preexisting `=~` and `!~` operators, respectively. The only reason to use one form over the other is preference. For example, people familiar with SQL may prefer using `like` and `not-like`. In the future, there is a chance that the shorter forms may be removed, but there are no plans to do so yet, if at all.

### `history import`

Thanks to [@qfel](https://github.com/qfel) in [#13450](https://github.com/nushell/nushell/pull/13450), this release adds the `history import` command. Running this command takes the history from the alternate history file format and imports it into the currently configured history file format. For example, to migrate from plain text to sqlite:

```nu
# Current format is plain text
# $env.config.history.file_format == plaintext
# Change the file format. Make sure to set this in your config if you want to persist this change.
$env.config.history.file_format = 'sqlite'
# Import the old history to the new format. It will create a backup if necessary.
history import
```

You can also pipe new history entries into `history import`, and they will be added to your history file. See `help history import` for some examples.

### `catch` error record

In [#14082](https://github.com/nushell/nushell/pull/14082), two additional columns were added to the error record passed to catch blocks/closures:

- `json`: a string containing the error data as JSON.
- `rendered`: a string containing the pretty formatted error message, roughly the same as you would see in your terminal.

### `help commands` and `scope commands`

The `help commands` and `scope commands` now output an `is_const` column indicating whether a command can be used in a parse-time constant context ([#14125](https://github.com/nushell/nushell/pull/14125)).
### `url split-query` [[toc](#table-of-content)]

### `ps -l`

On macOS, `ps -l` now lists the `start_time` of the processes. Windows and Linux already listed a `start_time` column ([#14127](https://github.com/nushell/nushell/pull/14127)).
This release adds a new `url split-query` command in [#14211](https://github.com/nushell/nushell/pull/14211) thanks to [@Bahex](https://github.com/Bahex). It is the counterpart to `url build-query` and splits a url query string into its different parameters. It returns a table with two columns: `key` and `value`.

### `url build-query`

Expand All @@ -105,6 +118,22 @@ Thanks to [@adaschma](https://github.com/adaschma) in [#14073](https://github.co
# a=1&a=2&b=3
```

### `touch --no-deref`

Thanks to [@Dorumin](https://github.com/Dorumin) in [#14214](https://github.com/nushell/nushell/pull/14214), a new `--no-deref` flag was added to `touch`. Providing this flag will make `touch` not follow symlinks.

### `help commands` and `scope commands`

The `help commands` and `scope commands` now output an `is_const` column indicating whether a command can be used in a parse-time constant context ([#14125](https://github.com/nushell/nushell/pull/14125)).

### `ps -l`

On macOS, `ps -l` now lists the `start_time` of the processes. Windows and Linux already listed a `start_time` column ([#14127](https://github.com/nushell/nushell/pull/14127)).

### `length`

Thanks to [@sgvictorino](https://github.com/sgvictorino) in [#14224](https://github.com/nushell/nushell/pull/14224), the `length` command now supports binary values as input and returns the number of bytes.

### `stor`

`stor` now supports list and table inputs thanks to [@friaes](https://github.com/friaes) in [#14175](https://github.com/nushell/nushell/pull/14175).
Expand All @@ -123,7 +152,7 @@ In [#14158](https://github.com/nushell/nushell/pull/14158), the `--no-newline`/`

### `open --raw`

After [#14141](https://github.com/nushell/nushell/pull/14141), `open --raw` now sets the `content-type` in the pipeline metadata for `nu`, `nuon`, and `json` files.
After [#14141](https://github.com/nushell/nushell/pull/14141), `open --raw` now sets the appropriate `content-type` in the pipeline metadata for `nu`, `nuon`, and `json` files.

### `help`

Expand All @@ -133,8 +162,85 @@ The `help` output for commands now shows the command type in parenthesis after t

A new option has been introduced for table rendering by [@zhiburt](https://github.com/zhiburt) in [#14070](https://github.com/nushell/nushell/pull/14070). With `$env.config.table.footer_inheritance = true`, if one of the inner rendered tables trips the footer mode setting to show a footer at the bottom of the table, all of the outer tables will also have footers rendered.

### Function key keybindings

Thanks to [@hacker-DOM](https://github.com/hacker-DOM) in [#14201](https://github.com/nushell/nushell/pull/14201), the function keys from F21 to F35 are now allowed in key bindings. Note that for the keys to work, support for the kitty keyboard protocol needs to be enabled in your config (`$env.config.use_kitty_protocol`) and your terminal also needs to support the protocol.

## Breaking changes [[toc](#table-of-content)]

### Division, floor division, and `mod`

In [#14157](https://github.com/nushell/nushell/pull/14157), several changes were made to the division related operators to make them more consistent.

### Division

First, division between two integers used to be able to return either an int or a float value even though the type signature claimed the result would always be a float.

```nu
(1 / 2 | describe) == float
(2 / 2 | describe) == int
```

This release changes division between any two types to always return a float **except** if the left hand side is a filesize or duration and the right hand side is an int or float.

```nu
(1 / 2 | describe) == float
(2 / 2 | describe) == float
(1KB / 1KB | describe) == float
(2sec / 2sec | describe) == float
# There is no floating point representation for filesizes and durations,
# so truncating division is used in this case.
(5B / 2) == 2B
(2sec / 2.0) == 1sec
```

#### Floor division

Second, floor division now does automatic float promotion. That is, if one of the operands is a float, and the other is an int or float, then the result will be a float. This matches the behavior of other operators like addition and multiplication which do float promotion as well. It also avoids potential overflows when trying to convert a large magnitude float into an int.

```nu
# Before
(1 // 1 | describe) == int
(1 // 1.0 | describe) == int
(1.0 // 1.0 | describe) == int
# After
(1 // 1 | describe) == int
(1 // 1.0 | describe) == float
(1.0 // 1.0 | describe) == float
```

Additionally, the previous implementation of floor division performed unnecessary clamping which has been fixed with this release. So, results should now be more accurate.

#### `mod`

In previous releases, the implementation of `mod` was based off of truncating division even though Nushell does not have a truncating division operator. This release changes `mod` to be based off of floor division so that `mod` and floor division in combination can satisfy the division rule:

```nu
let quotient = $n // $d
let remainder = $n mod $d
$n == $quotient * $d + $remainder
```

If the signs of the divisor and dividend are the same, then the result of `mod` will be the same as before. However, if the signs are not the same, then the result of `mod` will be different compared to before to satisfy the division rule.

```nu
# Before
let q = 8 // -3 # -3
let r = 8 mod -3 # 2
8 == $q * -3 + $r # false
# After
let q = 8 // -3 # -3
let r = 8 mod -3 # -1
8 == $q * -3 + $r # true
```

This matches the behavior of Python's `//` and `%` operators which were the original inspiration.

Otherwise, the implementation of all the division related operators has been improved to account for overflow. Rather than silently clamping or overflowing, the operators will now create an error in these cases.

### Lone, leading pipe in closures

Currently, a leading pipe character is allowed for pipelines in Nushell:
Expand Down Expand Up @@ -186,19 +292,57 @@ plugin list | where status == running

In case you want to avoid loading the plugin registry file (e.g. for performance reasons), you can now use the `--engine` flag to do so. Similarly, the `--registry` flag will only display the contents of the registry, without comparing them against the state of the engine (but all plugins will appear as `added`). The `--plugin-config` flag is now supported to allow use of a separate plugin registry file, identically to the other `plugin` commands.

## Deprecations [[toc](#table-of-content)]
### `url parse`

Thanks to [@Bahex](https://github.com/Bahex) in [#14211](https://github.com/nushell/nushell/pull/14211), the `params` field output for `url parse` is now a table with a `key` and `value` column instead of a record to match the new `url split-query` command ([see above](#url-split-query-toc)).

### `http` `--max-time`

With [#14237](https://github.com/nushell/nushell/pull/14237), the `--max-time` flag for the `http` family of commands now takes a duration value instead of a integer number of seconds. Thanks to [@alex-kattathra-johnson](https://github.com/alex-kattathra-johnson) for making this change!

### Empty rest matches

If a list rest pattern match ended up being empty, the match variable would previously be `null`. In [#14246](https://github.com/nushell/nushell/pull/14246) thanks to [@CharlesTaylor7](https://github.com/CharlesTaylor7), the match variable will instead be an empty list if no matches are found.

```nu
# Before
match [] {
[..$rest] => ($rest == null) # true
}
# After
match [] {
[..$rest] => ($rest == []) # true
}
```

### Case insensitive sorting

The method used for case insensitive comparisons and sorting has been updated/improved this release in [#14255](https://github.com/nushell/nushell/pull/14255) thanks to [@132ikl](https://github.com/132ikl). This will affect the output of `sort -i`, `uniq -i`, `get -s`, `find -i`, `str contains -i`, `str starts-with -i`, `str ends-with -i`, tab completions, and probably a few other commands (this list is not exhaustive).

### `ansi clear_entire_screen_plus_buffer`

In [#14184](https://github.com/nushell/nushell/pull/14184), `ansi clear_entire_screen_plus_buffer` now returns an ansi code that clears both the screen and scrollback buffer. Previously, it would only clear the scrollback buffer. In addition, a new `clear_scrollback_buffer` entry has been added to the `ansi` command. This will clear only the scrollback buffer.

## Removals [[toc](#table-of-content)]

### `std/dirs`

The `std/dirs` module is no longer loaded by default on startup after [#14242](https://github.com/nushell/nushell/pull/14242). See the [previous release notes](https://www.nushell.sh/blog/2024-10-15-nushell_0_99_0.html#standard-library-std-dirs-toc) for more information.

## Bug fixes and other changes [[toc](#table-of-content)]

### `return`
### `return`, `break`, and `continue`

In [#14120](https://github.com/nushell/nushell/pull/14120), a bug was fixed were `return`, `break`, and `continue` would set the last exit code to 1.

### External command bareword arguments

There was a bug where "expressions" inside barewords created using backticks would be evaluated if provided as arguments to external commands. This has been fixed with [#14210](https://github.com/nushell/nushell/pull/14210).

### `to text`

`to text` would previously have different behavior for list values and streaming list input. This has been fixed with [#14158](https://github.com/nushell/nushell/pull/14158), and the behavior for list streams is now used for list values.
`to text` previously had different behavior for list values and streaming list input. This has been fixed with [#14158](https://github.com/nushell/nushell/pull/14158), and the behavior for list streams is now used for list values.

### `to nuon`

Expand Down Expand Up @@ -230,6 +374,22 @@ The formatting has also been changed in [#14197](https://github.com/nushell/nush

The step value for ranges was previously not taken into account when checking if a value was `in` a range. Thanks to [@JoaquinTrinanes](https://github.com/JoaquinTrinanes), this has been fixed with [#14011](https://github.com/nushell/nushell/pull/14011).

### `into datetime`

After [#14266](https://github.com/nushell/nushell/pull/14266), times are kept intact when performing conversion to the local time zone for parsed human date strings.

### `ansi -l`

The preview column from `ansi -l` now also shows bold, dimmed, blink, and other effects thanks to [@NotTheDr01ds](https://github.com/NotTheDr01ds) in [#14196](https://github.com/nushell/nushell/pull/14196).

### `join`

An issue where table literal arguments to `join` were not parsed correctly has been fixed in

### Table literals as arguments

An issue where table literals were incorrectly parsed when used as arguments to commands has been fixed in [#14190](https://github.com/nushell/nushell/pull/14190) and [#14226](https://github.com/nushell/nushell/pull/14226) thanks to [@sgvictorino](https://github.com/sgvictorino).

### `clear`

On some terminals, `clear` would behave weirdly if used in a series of commands. Thanks to [@NotTheDr01ds](https://github.com/NotTheDr01ds), this has been fixed in [#14181](https://github.com/nushell/nushell/pull/14181).
Expand All @@ -256,6 +416,8 @@ https://github.com/nushell/nushell/pull/14128
https://github.com/nushell/nushell/pull/14229
https://github.com/nushell/nushell/pull/14230
https://github.com/nushell/nushell/pull/14291
https://github.com/nushell/nushell/pull/14307
https://github.com/nushell/nushell/pull/14002
-->

# Full changelog [[toc](#table-of-content)]
Expand Down

0 comments on commit 9aaaa7a

Please sign in to comment.