Skip to content

add any -> record to metadata#9755

Merged
sophiajt merged 2 commits intonushell:mainfrom
amtoine:fix-metadata-signatures
Jul 20, 2023
Merged

add any -> record to metadata#9755
sophiajt merged 2 commits intonushell:mainfrom
amtoine:fix-metadata-signatures

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented Jul 20, 2023

Description

in the help page of metadata, there is the following example

ls | metadata

which gives the following error

Error: nu::parser::input_type_mismatch

  × Command does not support table input.
   ╭─[entry #2:1:1]
 1 │ ls | metadata
   ·      ────┬───
   ·          ╰── command doesn't support table input
   ╰────

this PR adds any -> record to the signatures of metadata to allow the use of that kind of example.

User-Facing Changes

ls | metadata will work again

Tests + Formatting

  • 🟢 toolkit fmt
  • 🟢 toolkit clippy
  • toolkit test
  • toolkit test stdlib

After Submitting

Signature::build("metadata")
.input_output_types(vec![(Type::Nothing, Type::Record(vec![]))])
.input_output_types(vec![
(Type::Nothing, Type::Record(vec![])),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need Type::Nothing if you have Type::Any

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh that's a good point 👌

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed in 3693423

@sholderbach sholderbach added the A:type-system Problems or features related to nushell's type system label Jul 20, 2023
@sophiajt sophiajt merged commit 693cb5c into nushell:main Jul 20, 2023
@amtoine amtoine deleted the fix-metadata-signatures branch July 21, 2023 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:type-system Problems or features related to nushell's type system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants