A tool that makes data sharing between terminal windows easy.
abra can be used for displaying info about the current working directory, for splitting stdout and stderr and much more.
In the example below, whenever I cd into a different folder, another terminal window lists the files inside it.
- Installation
- Basic concepts
- Common use cases
- Advantages over named pipes
- Forcing colorized output
- Similar tools
- Etymology
The recommended way to install abra is by running:
cargo install kadabraYou can also run:
brew install denisidoro/tools/abraIf these package managers aren't available, you can download a pre-compiled binary here and extract it to your $PATH.
- abra is built over Unix sockets
- it can publish and subscribe to channels, manipulating text as necessary
- no terminal multiplexers are necessary
Some abra calls are quite verbose, so the use of aliases is recommended.
Since this is a very common use case, abra provides a hook for you.
If you call the following...
eval "$(abra hook bash)" # If you use bash, add this to ~/.bashrc
eval "$(abra hook zsh)" # If you use zsh, add this to ~/.zshrcThen you can open a new terminal window and call abra rx --channel pwd --cmd 'ls {}'.
Whenever you cd into a directory, the sidebar will reflect the changes.
Let's say that you want to run some tests but errors should appear in a different window.
You can use anonymous pipes with abra for that purpose:
The commands are:
abra rx --channel test_out # window 1
abra rx --channel test_err # window 2
cargo test > >(abra tx --channel test_out) 2> >(abra tx --channel test_err) # window 3Let's say you want to see the contents of a file in a window but show only the lines that contain "foo" in another window:
abra rx --channel filter --cmd 'echo "{}" | grep foo' # window 1
cat myfile.txt |& tee >(abra tx --channel filter) # window 2Some CLIs will detect that they are being piped and will hide color information by default.
To circumvent this, each CLI may offer different parameters: --color=always and export COLORTERM=truecolor are some examples.
In some cases, you need to trick an application into thinking its stdout is a terminal, not a pipe. For these cases you can call abra faketty --cmd '<your command>'.
In theory, you could run the following to achieve similar results:
mkfifo tmp
tail -f tmp
echo foo > tmp # in another windowThat said:
- with abra you don't need to worry about creating/removing named pipes
echo foo > tmpis blocking in casetmpisn't open for readingabra txwill terminate immediately if there's noabra rxprocess
- you can have many
abra rxwindows reacting to the sameabra txcall - abra is cross-platform
- to correctly create temporary named pipes you need to write platform-specific code