guish (goo-ish) is a dynamic data pipeline UI that allows users to visually construct and execute complex command-line pipelines. It provides an intuitive interface for chaining together various Unix commands and custom plugins, making it easier to build and understand data processing workflows.
This is an exploratory project in nature, seeing how text input and GUI input can complement each other in a novel manner.
I do a lot of data science and hop between the command line, Jupyter notebooks, R Studio, and VS Code, but there's something unsatisfactory about all of them. Embedding a SQL query in another language like R puts the SQL in a secondary position. The command line keeps every language on the same level but is a rather poor interface for writing code. This application attempts to bridge the gap.
Updates to the prompt are parsed into an AST and used to update the GUI. Updates in the GUI are used to build an AST to update the prompt. The output of each command in the pipeline is displayed in the terminal-like display below the input area. For HTML output, the rendered results are displayed in the right-hand panel.
Instead of having to write something like this into the line editor, sometimes preferable for a first approach
pg -d test_database -c 'SELECT * from test_table;' | tsvtocsv | ggplot 'ggplot(df, aes(as.Date(date), value)) +
geom_col(fill = "red") +
labs(x = "date") +
theme_minimal()' | pngtohtml
One can write,
pg | tsvtocsv | ggplot | pngtohtml
And then fill in the blanks in the GUI with a fully fledged code editor like Monaco all while seeing the output of each step in the pipeline.
Commands are executed as-is in a shell process. The application is merely a tool used to construct commands and pipelines.
- Visual representation of command-line pipelines
- Visible output after each command in the pipeline
- Real-time parsing of commands
- Support for custom plugins and command modules
- Bidirectional updates from CLI or GUI command modules
- Multiple output display formats:
- Raw text output
- JSON viewer for structured data
- Table view for CSV/TSV data
- HTML rendering of command output
- Electron-based desktop application for cross-platform support
- Code editor integration for complex commands (e.g., SQL, AWK, R, Python)
- Keyboard shortcut (Alt+Enter) for quick command execution
- Configurable shell and preload script via
.guish
configuration file - File operations (New, Open, Save, Save As) for pipeline scripts
- Directory selection for the
cd
command - Copy-to-clipboard functionality for pipeline outputs
guish currently supports the following commands and plugins:
- echo
- cat
- grep
- sed
- awk
- pg (PostgreSQL)
- ggplot
- sort
- uniq
- wc
- head
- tr
- cut
- tee
- xargs
- prependcss
- cd
- jq (JSON processing)
- curl (HTTP requests)
- node (JavaScript execution)
- python (Python script execution)
- ruby (Ruby script execution)
- paste
- Generic command support for unsupported commands
These are both custom shell functions that will need to be included in a file referenced by the preloadScript
section of the ~/.guish
configuration.
pg
requires that psql
is on the host system.
function pg() {
local query=""
local args=()
local input_from_stdin=1 # Assume input is from stdin initially.
# Process arguments
while (( "$#" )); do
if [[ "$1" == "-c" ]]; then
if [[ -n "$2" ]]; then
query="$2" # Set the query from the next argument
shift 2 # Skip the next argument as it's the query
input_from_stdin=0 # No input from stdin since query is specified
break
else
echo "Error: Expected a query after -c flag"
return 1
fi
else
args+=("$1") # Collect other arguments
shift
fi
done
# Read query from stdin if not provided via -c
if [[ "$input_from_stdin" -eq 1 ]]; then
query=$(cat)
fi
# Execute the query with collected arguments
psql -X -A -F $'\t' --no-align --pset footer=off "${args[@]}" -c "$query"
}
ggplot
requires that R and rush are on the host system.
function ggplot() {
if [[ "$1" == "-f" ]]; then
shift
rush run --library tidyverse "$(cat "$1")" -
else
rush run --library tidyverse "$@" -
fi
}
- Node.js (v14 or later)
- npm (v6 or later)
-
Clone the repository:
git clone https://github.com/williamcotton/guish.git cd guish
-
Install dependencies:
npm install
guish uses a configuration file located at ~/.guish
to customize its behavior. If this file doesn't exist, guish will use default settings.
To create or modify the configuration, create a file named .guish
in your home directory with the following content:
{
"shell": "zsh",
"preloadScript": ""
}
shell
: Specifies the shell to use for executing commands (default: "zsh")preloadScript
: A script to run before executing each command (default: "")
For example, if you want to source your custom functions before each command, you can set:
{
"shell": "zsh",
"preloadScript": "source ~/.zshrc"
}
To start the application in development mode:
npm start
This will launch the Electron app with hot-reloading enabled.
To build the application for production:
npm run make
This will create distributable packages for your platform in the dist
directory.
- Enter your command pipeline in the input area at the bottom of the screen.
- The pipeline will be parsed and represented visually as a series of modules.
- Modify individual command parameters using the provided UI components or in the CLI.
- Click the "Execute" button or press Alt+Enter to run the pipeline.
- View the output in the terminal-like display below the input area.
- For HTML output, check the right-hand panel for rendered results.
- Use the File menu or keyboard shortcuts to create new pipelines, open existing ones, or save your work.
Contributions are welcome! Please feel free to submit a Pull Request or at the very least open a detail Issue.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the ISC License.
- This project uses various open-source libraries and tools. We're grateful to the developers and contributors of these projects.
- Special thanks to the Electron, React, and Tailwind CSS communities for their excellent frameworks and documentation.
- Extra thanks to Claude Projects with the Artifacts plugin for giving me the time and energy to work on such experiments.