forked from extern/nushell
add metadata access
command (#13785)
# Description Add `metadata access`, which allows accessing/inspecting the metadata of a stream in a closure. ```nu ls | metadata access {|meta| ... } ``` - The metadata is provided as an argument to the closure, identical to the record obtained with `metadata` command. - `metadata access` passes its input stream into the closure as it is. - Within the closure, both the metadata and the stream are available. The closure may modify, collect or pass the stream as it is. # Motivation - Without this command, nu code can't act on metadata without losing the stream, use cases requiring both the stream and metadata must be implemented either as a built-in or a plugin. - This command allows users to enhance presentation of data, similar to `table` coloring the output of `ls`.
This commit is contained in:
@ -151,6 +151,7 @@ pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
|
||||
Explain,
|
||||
Inspect,
|
||||
Metadata,
|
||||
MetadataAccess,
|
||||
MetadataSet,
|
||||
TimeIt,
|
||||
View,
|
||||
|
Reference in New Issue
Block a user