diff options
-rw-r--r-- | .gitignore | 21 | ||||
-rw-r--r-- | README.md | 66 |
2 files changed, 87 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81a4762 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +*.o +*.a +*.pyc +#*# +*~ +*.swp +.* +*.tmp +*.old +*.profile +*.bkp +*.bak +[Tt]humbs.db +*.DS_Store +build/ +_build/ +src/build/ +*.log + +# Don't ignore this file itself +!.gitignore diff --git a/README.md b/README.md new file mode 100644 index 0000000..1de9277 --- /dev/null +++ b/README.md @@ -0,0 +1,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 + |