aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 1de92779cedd76ebcd6a0b54a54e591dc5cf7a2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

aft: ASCII Framed Tables
===========================

Like TSV, but using ASCII control characters to distinguish headers, fields, and rows.

Store tabular data in files, or for simple structured data transfer between
programs and over networks.

file suffix: `.aft`

mimetype (speculative): `text/aft`

## Format

The special characters are:

- `0x01  1 SOH`: "Start of Header"
- `0x02  2 STX`: "Start of Text"
- `0x03  3 ETX`: "End of Text"
- `0x1C 28  FS`: "File Separator"
- `0x1D 29  GS`: "Group Separator"
- `0x1E 30  RS`: "Record Separator"
- `0x1F 31  US`: "Unit Separator"

Tools and file readers check the start of stream. If it is `0x01`, can treat as
`aft`; otherwise treat as regular text. `0x02` terminates header section and
starts contents. Header records could somehow include:

- column names
- column types (default is string)
- indicate sort order (columns, asc/desc)

General structure of tables is:

- units: for arrays of values in a cell (no other structure)
    => could be "array" (variable-length, single type) or "tuple" (fixed-length, names and types for each slot)
- records: for cells in 2-dimensional grid
- groups: rows of table (or, use newline, so regular tools work?)
- file: unused; could be "sheets"? sort of redundant with "end of text" character

Comments and annotations are not supported.

## Extras

Text editor support: coloring, easy entry of special chars, highlighting
errors, tab-separation.

Unfortunately, my terminal (xterm) interprets Ctrl-V Ctrl-_ as "resize smaller".

## Column Types

Encoding is that of JSON or TOML. Values can be:

- string (UTF-8) (default if not specifier)
- integer number
- floating point number
- boolean
- date, timestamp
- null

## Examples

    cargo run --bin aft-demo | cat -v
    cargo run --bin aft-demo | cut -f1 -d$'\036' | cat -v