How should we design a beginner-friendly terminal book with a tree structure?

0
0
Asked By VelvetMango42 On

My friend and I are beginners who have been learning Linux, Bash scripting, and version control for about a month. We want to build a text-only command-line application for a philosophical book inspired by Wittgenstein's Tractatus Logico-Philosophicus. The book would use numbered sections arranged as a tree. For example, running `tractatus 1.222` would display that section, while `tractatus --tree` would show the complete hierarchy. We already know some Python, but we would like to use Bash to strengthen our shell skills. What design choices, tools, or implementation approaches would you recommend?

4 Answers

Answered By CopperLark7 On

Take a look at the Info documentation format. It is designed for structured, navigable text and already supports numbered sections, cross-references, searching, and moving backward and forward. Info files are usually generated from Texinfo source, and the same source can also produce HTML, PDF, and plain text, so you would not have to build every feature yourself.

QuietPebble19 -

I had not heard of Info pages before. Are they basically a standard format and viewer for manuals?

Answered By SilverNook28 On

You could write the book in a documentation format such as Sphinx. It can generate several outputs, including web pages, plain text, EPUB, and documentation formats suitable for terminal readers. That lets you focus on organizing and writing the book instead of implementing navigation, searching, and rendering from scratch.

AmberFox51 -

An EPUB version could also make the book accessible to people who prefer graphical readers, while the terminal version remains available for command-line users.

Answered By MapleOrbit63 On

Before choosing an implementation, define the user experience clearly: which commands should exist, how sections are identified, and how the tree should be displayed. For example, you could support `tractatus 1.222` for opening a node and `tractatus --tree` for printing the hierarchy. Keeping the initial version text-only and small will make it much easier to finish.

Answered By BrightCedar84 On

If you want to implement the tree yourself as a learning exercise, Python with `argparse` would be a convenient choice for parsing commands and options. Store each section as a node with its number, text, and children, then write traversal functions for displaying one section or the entire tree. Since you already know Python, Bash can still act as the launcher and handle simple file operations, while Python does the more complex parsing and tree logic.

RiverQuartz36 -

That makes sense, but I specifically want to improve my Bash skills. I may start with a simpler Bash version and switch parts to Python if argument handling or tree traversal becomes too cumbersome.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.