datui-cli 0.4.1

Shared CLI definitions for datui (Args, CompressionFormat)
Documentation
# The examples `datui --help`, the manpages, the command-line reference and the
# README show, in order. Each runs exactly as written, on a fresh install.
#
# command      What to type.
# description  What it does, in one line.
# test         How scripts/docs/doc_examples.py runs it:
#                run          locally, in an empty directory, on every pull request
#                network      in the nightly job: it reads public data
#                interactive  locally; its producer never ends and is stopped once
#                             the first rows show
# expect       What counts as working, when it is not the default: `rows` (the
#              table shows rows; the default when it opens something), `screen`
#              (a screen that stays up, such as the home screen), `exit` (a command
#              that prints and exits 0; the default for subcommands)
# pages        The manpages whose EXAMPLES show it, as NAME.SECTION (default
#              ["datui.1"]); `datui --help` shows those of datui.1, and
#              `datui COMMAND --help` those of datui-COMMAND.1
# files        Files the command reads, written into its directory first and shown
#              above it: [{ name = "config.toml", text = """...""" }]. Never
#              create a file in the command itself

[[example]]
command = "datui"
description = "Open the home screen. Example datasets lists the catalog that comes with datui"
test = "run"

[[example]]
command = "datui https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv"
description = "Palmer penguins from the web"
test = "network"

[[example]]
command = "datui s3://noaa-ghcn-pds/parquet/by_year/YEAR=2024/ELEMENT=TMAX/"
description = "NOAA daily highs for 2024, one table from public S3"
test = "network"

[[example]]
command = "datui --hive 's3://noaa-ghcn-pds/parquet/by_year/YEAR=2024/ELEMENT=T*/*.parquet'"
description = "A glob, read as one partitioned table: every 2024 element starting with T"
test = "network"

[[example]]
command = "datui abfss://release@overturemapswestus2.dfs.core.windows.net/"
description = "Overture Maps releases in public Azure storage, listed on the home screen"
test = "network"
expect = "screen"

[[example]]
command = "datui https://huggingface.co/openai-community/gpt2/resolve/main/model.safetensors"
description = "A model's tensors, read from its header without downloading the weights"
test = "network"

[[example]]
command = "printf 'id,amount\\n1,9.50\\n2,3.25\\n' | datui"
description = "Data piped in; the format is read from its first bytes"
test = "run"

[[example]]
command = "journalctl -o json -n 1000 | datui"
description = "The last 1,000 systemd journal entries, a column per field"
test = "run"

[[example]]
command = "(echo time,value; while sleep 0.2; do echo \"$(date +%s),$RANDOM\"; done) | datui -f -"
description = "Rows as they arrive; t pauses, Esc stops following"
test = "interactive"

[[example]]
command = "datui --hex /bin/sh"
description = "A file's bytes in the hex view"
test = "run"
expect = "screen"

[[example]]
command = "datui -c display.row_numbers=true https://vincentarelbundock.github.io/Rdatasets/csv/palmerpenguins/penguins.csv"
description = "Any config key, for this run"
test = "network"

[[example]]
command = "datui config init"
description = "Write the config file, every key commented out at its default"
test = "run"
pages = ["datui.1", "datui-config.1", "datui-config.5"]

[[example]]
command = "datui formats"
description = "List the format specs and dictionaries datui finds"
test = "run"
pages = ["datui.1", "datui-formats.1"]

[[example]]
command = "datui man keys"
description = "The keys of every screen, as a manual page"
test = "run"
pages = ["datui.1", "datui-man.1", "datui-keys.7"]

[[example]]
command = "datui catalog show examples"
description = "Print the catalog datui ships, the worked example of the format"
expect = "exit"
test = "run"
pages = ["datui.1", "datui-catalog.1"]

[[example]]
command = "datui catalog show"
description = "List the catalogs: id, label, datasets and file"
expect = "exit"
test = "run"
pages = ["datui-catalog.1"]

[[example]]
command = "datui catalog check team.toml"
files = [
  { name = "team.toml", text = """
label = "Team data"

[orders]
name = "Orders"
path = "data/orders.parquet"
description = "Every order, one row each"
columns.status = { description = "Where the order is", values = { P = "Placed", S = "Shipped" } }
""" },
]
description = "Check a catalog file and list its datasets"
expect = "exit"
test = "run"
pages = ["datui-catalog.1"]

[[example]]
command = "datui theme list"
description = "List the themes: name, the mode it is set for, file and description"
expect = "exit"
test = "run"
pages = ["datui-theme.1"]

[[example]]
command = "datui theme show night-market"
description = "Print the built-in dark theme with every slot, a file to start a theme from"
expect = "exit"
test = "run"
pages = ["datui-theme.1"]

[[example]]
command = "datui config path"
description = "The config files read, lowest precedence first"
test = "run"
pages = ["datui-config.1", "datui-config.5"]

[[example]]
command = "datui config keys -c display.row_numbers=true"
description = "Every key: its type, default, the value in effect and what set it, here -c"
test = "run"
pages = ["datui-config.1"]

[[example]]
command = "DATUI_CONFIG_DIR=. datui config keys"
files = [
  { name = "config.toml", text = """
[display]
row_numbers = true
""" },
]
description = "The values a config file in the current directory sets"
test = "run"
pages = ["datui-config.5"]

[[example]]
command = "datui cache clear --recents"
description = "Forget the recent datasets and keep the rest of the cache"
test = "run"
pages = ["datui-cache.1"]

[[example]]
command = "datui cache clear"
description = "Clear the whole cache: recents, prompt history, schemas and copies"
test = "run"
pages = ["datui-cache.1"]

[[example]]
command = "datui views list"
description = "The saved views: name, the files each matches, when last used"
test = "run"
pages = ["datui-views.1"]

[[example]]
command = "python3 make_pairs.py && datui formats check ./pairs.toml t.pairs"
files = [
  { name = "pairs.toml", text = """
name = "demo.pairs"
match = { glob = ["*.pairs"] }

[records]
fields = [{ name = "a", type = "u1" }, { name = "b", type = "u1" }]
""" },
  { name = "make_pairs.py", text = """
# Two records of two one-byte fields: (1, 2) and (3, 4).
with open("t.pairs", "wb") as f:
    f.write(bytes([1, 2, 3, 4]))
""" },
]
description = "Check a format spec of two one-byte fields against a file of two records, and print the rows it reads"
test = "run"
pages = ["datui-formats.1"]

[[example]]
command = "mkdir -p ~/.local/share/bash-completion/completions && datui completions bash > ~/.local/share/bash-completion/completions/datui"
description = "Bash completion for your user; new shells load it through bash-completion"
test = "run"
pages = ["datui-completions.1"]

[[example]]
command = "mkdir -p ~/.config/fish/completions && datui completions fish > ~/.config/fish/completions/datui.fish"
description = "fish completion for your user"
test = "run"
pages = ["datui-completions.1"]

[[example]]
command = "mkdir -p ~/.zfunc && datui completions zsh > ~/.zfunc/_datui"
description = "zsh completion; add fpath+=~/.zfunc before compinit in ~/.zshrc"
test = "run"
pages = ["datui-completions.1"]

[[example]]
command = "datui man --list"
description = "The manual pages and what each covers"
test = "run"
pages = ["datui-man.1"]

[[example]]
command = "datui man --dir ~/.local/share/man"
description = "Write every page where man finds them for your user, as after cargo install"
test = "run"
pages = ["datui-man.1"]