describe

Synopsis

any |> describe

Description

describe lists the fields of the records that reach it. It replaces the inspection of an object with Get-Member and answers the question which fields a following filter, select or sort can use.

The result has one field_info record per field:

Field Content
field name of the field
type language type of the values; mixed when the records hold values of different types in the field
example the first value that is not null
required true when every input record has the field
records number of input records that have the field

Fields appear in the order of their first occurrence, so the order of the definition of the record kind is kept. Fields that are computed on request (hash, encoding, line_ending, mime, language, binary, lines) are listed only when the producing command computed them, and then show required: false when some records lack them.

Empty input yields no records. Input that is a single value instead of records fails with E_TYPE. The result is deterministic: the same input gives the same records in the same order.

Parameters

The command has no parameters.

Input and output

Form Input Output
default any field_info

Effect

Property Value
Category transform
Effect read
Reversibility read
Implementation builtin

Examples

List the fields of the entries of a directory.

list "/home/user/app" |> describe
{ "format": "nurt-fs-snapshot/1", "entries": [
  { "path": "/home/user/app", "type": "dir" },
  { "path": "/home/user/app/a.go", "type": "file", "content_utf8": "package main\n" }
] }
path

Show only the fields that not every record has.

find "/home/user/app" glob: "**/*" |> describe |> filter required == false
{ "format": "nurt-fs-snapshot/1", "entries": [
  { "path": "/home/user/app", "type": "dir" },
  { "path": "/home/user/app/a.go", "type": "file", "content_utf8": "package main\n" }
] }

Show the fields of the matches of a search with their types.

search "main" "/home/user/app" |> describe |> select field type
{ "format": "nurt-fs-snapshot/1", "entries": [
  { "path": "/home/user/app", "type": "dir" },
  { "path": "/home/user/app/a.go", "type": "file", "content_utf8": "package main\n" }
] }
column

Errors

Code Meaning Typical fix
E_TYPE the input is a single value, or describe is the first stage and has no records to describe put a source before it, for example list

help, select, filter, summarize.

Source file on GitHub: docs/commands/describe.md