$ show mklement0/ttab
ttab is a single-file Bash CLI that programmatically opens new terminal tabs and windows on macOS (Terminal.app and iTerm2) and Linux (gnome-terminal). It supports running startup commands in the new tab, setting working directory, title, and profile, creating iTerm2 horizontal/vertical splits (-v/-h), creating tabs without stealing focus (-g/-G), delaying command submission (-l), and clearing the screen (-q). The entire application is bin/ttab: a ~700-line Bash script with zero runtime dependencies that parses options via getopts, detects the calling terminal through TERM_PROGRAM / GNOME_TERMINAL_SCREEN or an explicit -a flag, synthesizes backend-specific automation (AppleScript for Terminal.app and iTerm2, with distinct v2/v3 syntax paths, and a CLI argument string for gnome-terminal), and executes it via 'exec osascript' on macOS or eval on Linux. It embeds its full Markdown man page as a here-doc extracted by sed, so --help, --man, and --man-source all work from the single distributed file.
The LLM identified 1 files worth highlighting for reuse:
The printManPageSource / openManPage / printUsage helper trio is a genuinely reusable pattern for shipping a CLI with its full man page embedded inside the script itself. The man page lives in a single-quoted here-doc (EOF_MAN_PAGE) inside the Bash file, and printManPageSource extracts it at runtime with a compact sed range trick (`sed -n -e $'/^: <<\'EOF_MAN_PAGE\'/,/^EOF_MAN_PAGE/ { s///; t\np;}'`). openManPage falls back gracefully from the installed roff man page, to the embedded Markdown, to the GitHub-hosted doc; printUsage extracts only the SYNOPSIS chapter for --help. --man-source emits the raw Markdown so the repo's Makefile can regenerate doc/ttab.md and man/ttab.1. This keeps docs in lockstep with code, requires only POSIX sed, and can be dropped into any new Bash CLI project by copying the three functions and the here-doc convention.