allow tables to have annotations (#9613)

# Description

follow up to #8529 and #8914

this works very similarly to record annotations, only difference being
that

```sh
table<name: string>
      ^^^^  ^^^^^^
      |     | 
      |     represents the type of the items in that column
      |
      represents the column name
```
more info on the syntax can be found
[here](https://github.com/nushell/nushell/pull/8914#issue-1672113520)

# User-Facing Changes

**[BREAKING CHANGE]**
this change adds a field to `SyntaxShape::Table` so any plugins that
used it will have to update and include the field. though if you are
unsure of the type the table expects, `SyntaxShape::Table(vec![])` will
suffice
This commit is contained in:
mike
2023-07-07 12:06:09 +03:00
committed by GitHub
parent 440a0e960a
commit 8e38596bc9
25 changed files with 343 additions and 153 deletions

View File

@ -32,6 +32,9 @@ impl Command for BytesIndexOf {
.input_output_types(vec![
(Type::Binary, Type::Int),
(Type::Binary, Type::List(Box::new(Type::Int))),
// FIXME: this shouldn't be needed, cell paths should work with the two
// above
(Type::Table(vec![]), Type::Table(vec![])),
])
.required(
"pattern",

View File

@ -26,7 +26,7 @@ impl Command for UpdateCells {
)
.named(
"columns",
SyntaxShape::Table,
SyntaxShape::Table(vec![]),
"list of columns to update",
Some('c'),
)