Text Files as a User Interface
4 hours ago
- #user-interface
- #automation
- #text-files
- Using text files as a user interface allows leveraging text editors for program input, bridging the gap between simple command-line arguments and full text-based UIs.
- Common examples include utilities like crontab -e, git commit, visudo, and vipw, which open temporary files in an editor for user input.
- A key advantage is persistence: text files can be kept around, preserving previous inputs and enabling reuse of settings or values.
- Text editors provide powerful editing capabilities without the need to build a custom UI, saving significant development effort.
- An example tool for managing a digital photo gallery uses an inbox.txt file as the UI, where editing the file controls actions like naming sets and tagging, with scripts handling backend tasks.
- Another example demonstrates controlling complex CLI tools (e.g., yt-dlp) via text files, allowing verbose comments, defaults, and reuse of settings without traditional UI programming.
- This approach integrates well into personal ecosystems of command-line tools, is editor-agnostic, and avoids reliance on editor-specific plugins or scripts.