Skip to content
keinsell edited this page Jan 24, 2025 ยท 1 revision

Non-Interactive Mode

Application offers non-interactive functionality which would modify the way of formatting information piped to stdout, meaning you can use application's data that you would normally see in a table by other software programs.

Non-interactive mode would activate automatically when the environment in which the application is running is not interactive (with use of a cargo library atty which contains complete specification on which conditions shell are considered interactive or not).

Non-interactive mode is de-facto modifying underlying logic for stdout formatting, application expose --format argument which forces usage of specified formatter for every of the following commands that is run by the application.

neuronek -f json ingestion list
[
  {
    "id": 1,
    "substance_name": "caffeine",
    "route": "Oral",
    "dosage": "10.0 mg",
    "ingested_at": "2025-01-06 04:40:27.253301"
  }
]

Examples

Pipe command output to another program

Non-interactive mode would automatically activate when you are piping output, which allows you to use any program that can ingest JSON and make use of it. Example shows how the application is used to list ingestion's and then use Nushell's JSON parser to build a pretty table, which is the default way nushell shows information.

> neuronek ingestion list | from json
โ•ญโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ # โ”‚ id โ”‚ substance_name โ”‚ route โ”‚ dosage  โ”‚        ingested_at         โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 0 โ”‚  1 โ”‚ caffeine       โ”‚ Oral  โ”‚ 10.0 mg โ”‚ 2025-01-06 04:40:27.253301 โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
Clone this wiki locally