Replace "function" with "command" in several user-facing doc (#15129)

This commit is contained in:
Douglas
2025-02-17 14:10:38 -05:00
committed by GitHub
parent 273226d666
commit 5d1e2b1df1
9 changed files with 44 additions and 47 deletions

View File

@ -1,40 +1,40 @@
# formats.nu
#
# This file contains functions for formatting data in various ways.
# This file contains helpers for formatting data in various ways.
#
# Usage:
# use std format *
# use std format <function name>
# use std/format *
# use std/format <command name>
#
# These functions help `open` the files with unsupported extensions such as ndjson.
# These custom commands help `open` the files with unsupported extensions such as ndjson.
#
# Convert from [NDJSON](https://github.com/ndjson/ndjson-spec) to structured data.
# Convert from NDJSON (https://github.com/ndjson/ndjson-spec) to structured data.
export def "from ndjson" []: string -> any {
from json --objects
}
# Convert from [JSONL](https://jsonlines.org/) to structured data.
# Convert from JSONL (https://jsonlines.org/) to structured data.
export def "from jsonl" []: string -> any {
from json --objects
}
# Convert structured data to [NDJSON](https://github.com/ndjson/ndjson-spec).
# Convert structured data to NDJSON (https://github.com/ndjson/ndjson-spec).
export def "to ndjson" []: any -> string {
each { to json --raw } | to text
}
# Convert structured data to [JSONL](https://jsonlines.org/).
# Convert structured data to JSONL (https://jsonlines.org/).
export def "to jsonl" []: any -> string {
each { to json --raw } | to text
}
# Convert from NDNUON (newline-delimited NUON), to structured data
# Convert from NDNUON (newline-delimited NUON) to structured data
export def "from ndnuon" []: [string -> any] {
lines | each { from nuon }
}
# Convert structured data to NDNUON, i.e. newline-delimited NUON
# Convert structured data to newline-delimited NUON (NDNUON)
export def "to ndnuon" []: [any -> string] {
each { to nuon --raw | str replace --all "\n" '\n' } | to text
}