Spec-Zone.ru › Nushell

metadata set for debug

Set the metadata for items in the stream.

Signature

> metadata set {flags} (closure)

Flags

  • --datasource-filepath, -f {path}: Assign the DataSource::FilePath metadata to the input.
  • --path-columns, -p {list<string>}: A list of columns in the input for which path metadata will be assigned.
  • --content-type, -c {oneof<string, nothing>}: Assign content type metadata to the input.

Parameters

  • closure: A closure that receives the current metadata and returns a new metadata record. Cannot be used with other flags.

Input/output types:

input output
any any

Examples

Set the metadata of a table literal so the name column is treated as a path.

> [[name color]; [Cargo.lock '#ff0000'] [Cargo.toml '#00ff00'] [README.md '#0000ff']] | metadata set --path-columns [name]

Set the metadata of a file path.

> 'crates' | metadata set --datasource-filepath $'(pwd)/crates'

Set the content type metadata.

> 'crates' | metadata set --content-type text/plain | metadata | get content_type
text/plain

Merge custom metadata.

> "data" | metadata set {|| merge {custom_key: "value"}} | metadata | get custom_key

Set metadata using a closure.

> "data" | metadata set --content-type "text/csv" | metadata set {|m| $m | update content_type {$in + "-processed"}} | metadata | get content_type
text/csv-processed

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/metadata_set.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API