Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add any -> record to metadata #9755

Merged
merged 2 commits into from Jul 20, 2023
Merged

Conversation

amtoine
Copy link
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

@@ -20,7 +20,10 @@ impl Command for Metadata {

fn signature(&self) -> nu_protocol::Signature {
Signature::build("metadata")
.input_output_types(vec![(Type::Nothing, Type::Record(vec![]))])
.input_output_types(vec![
(Type::Nothing, Type::Record(vec![])),
Copy link
Member

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
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
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 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
19 checks passed
@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
type-system Problems or features related to nushell's type system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants