txtflow is a command-line tool with a terminal user interface (TUI) that allows you to pipe data through a series of commands, similar to how you would use pipes in a shell. It's designed for interactive data processing and exploration.
txtflow is heavily insipred by up but built with bubbletea.
- Interactive Command Input: Enter shell commands in a text input field.
- Piping: Chain commands together using the
|(pipe) symbol, just like in a shell. - Stdin Support: Reads data from standard input (
stdin). - TUI Display: Displays the processed output within a scrollable viewport in the terminal.
- Error Handling: Shows error messages in the TUI if a command fails.
- Exit Options:
Ctrl+C: Exits the application.Ctrl+X: Exits the application and prints the last entered command to standard output. This is useful for copying the command for later use.
Prerequisites:
- Go (version 1.18 or later) must be installed.
Clone the repo and run
make installThe binary would built and installed to ~/.local/bin, make sure it is in your $PATH.
-
Pipe data to
txtflow:cat myfile.txt | txtflow # OR echo "Hello, world!" | txtflow # OR txtflow < myfile.txt
-
Enter commands:
- Once
txtflowis running, a text input field will appear. - Enter shell commands like
grep,wc,sed,awk, etc. - Use pipes (
|) to chain multiple commands together.
Example commands:
grep hello grep error | wc -l sed 's/world/TUI/g' jq -r '.[].name' | sort | uniq - Once
-
Execute commands:
- Press
Enterto execute the command. The output will be displayed in the viewport.
- Press
-
Exit:
- Press
Ctrl+Cto exit the application. - Press
Ctrl+Xto exit the application and print the last entered command to standard output.
- Press
- charmbracelet/bubbletea: A Go framework for building terminal apps.
- charmbracelet/bubbles: Provides UI components for Bubble Tea.
- charmbracelet/lipgloss: Style definitions for console layouts.
- google/shlex: Shell-style syntax parser.
