Programmatic terminal tabs and windows
Terminal emulators with tab support (opening multiple shell sessions at once) can often be controlled programmatically. Terminals that don’t might still offer split-screen or the ability to start a completely new terminal window.
The usefulness of this feature lies in the ability to accept a command that will be started in the new shell session. This is similar to using shell-based terminal multiplexers like tmux. In both cases the idea is to conveniently start multiple or separate things that can be controlled independently.
As an example, think about enhancing a project entry point that uses Docker Compose. By default, Docker Compose starts all containers, and the output from all services is displayed together in the same terminal window. However, with programmatic tabs, you could also create independent terminal tabs that attach to each container.
With tabs attached to the running processes, you can kill and restart things in the containers just by navigating to their tab and ending a process using classic CTRL+C or starting it again with shell command history—without the need to deal with the containers externally. In fact, this is how the default development entry point script works in Baserow:
Because the tab control differs across terminals, I recommend using a program like ttab that can handle a variety of terminals, although for personal use cases it might be enough to write terminal-specific commands. ttab also supports opening things in new terminal windows and split-screen setups for compatible terminals.
I believe that programmatic terminal multiplexing is great for improving local development experiences. What about you?
Have a nice weekend,
—Petr
(And check out my Command Line Handbook for more command-line stuff if you haven’t yet.)