1234567891011121314151617181920212223242526272829303132333435363738394041 |
- id: 'idea--thule-alternatives'
- content: |
- The big alternative I know of is
- [termkit](https://github.com/unconed/TermKit), which is an interesting
- experiment: but, to me, it's filled with far too many special cases
- and not enough nice primitives. For example, there's a special
- way of outputting a list of files (e.g. output from `ls`) but this
- isn't because "files" are necessarily a distinct thing, but because
- there's a special type of output for `ls`-like commands (in this
- case, `application/json; schema=termkit.files`, which corresponds
- to a list of filenames.)
- Thule builds on top of this by having a standard set of building
- blocks, so that you no longer have the special-case "list of files",
- but rather primitive building blocks like `list`s and `file`s.
- Consider the output from `wc`: this also contains file references,
- but it additionally contains a table mapping those to values. In
- a TermKit-like setting, you'd have to come up with a new schema
- (say, `application/json; schema=termkit.wordcount`) that understands
- which parts of the output are files and which aren't.
- Thule aims to pull those low-level building blocks out, so the
- output from `ls` might give you a collection like
- (set (file "/tmp/foo.txt") (file "/tmp/bar.c"))
- and the output from `wc` will give you
-
- (table ("lines" "words" "characters" "file")
- ((int 10) (int 30) (int 300) (file "/tmp/foo.txt"))
- ((int 20) (int 60) (int 900) (file "/tmp/bar.c"))
- ((int 30) (int 90) (int 1200) (text "total")))
-
- Both of these would not be displayed in a raw way by the shell, but
- rather the structure of the collections would be a hint to the
- shell on how to display them in a rich way.
- related:
- - name: idea--thule
- why: The high-level idea
|