README
tmeta
A console for your console
image i_user_images_githubusercontent_com_58956_89128554_6e741000_d4c4_11ea_846a_32189f23900c_png not found
Description
tmeta is a wrapper for tmux that supports sending and receiving data to/from tmux panes.
Anything typed into the bottom pane is sent to the top one, but
lines that start with a backslash are commands for tmeta.
You can type \help to see all possible commands.
(To send a literal leading backslash, either start with a space or start with a double backslash.)
Why
Because you get:
an uncluttered view of your commands separate from the output
a local history for commands that are run remotely
readline interface independent of the remote console
scripting support for programs that require a TTY
macros
the ability to monitor or capture output
other
expect-like functionalitycontrolled copy-and-paste operations into remote sessions
Quick start
See below for installation.
There are a few different ways to start tmeta.
Start
tmuxyourself, then havetmetasplit a window and start up in its own pane:$ tmux $ tmetaLet
tmetastart tmux for you:
$ tmetaRun a tmeta script. This will split and run in another pane.
$ tmux $ tmeta script.tm
I use the .tm suffix for my tmeta scripts. If you do too, you
might like this vim syntax file.
What do I use it with
tmeta plays well with REPLs, or any console based application that uses a tty. For instance, docker, rails console, interactive ruby shell, the python debugger, the jupyter console, psql, mysql, regular ssh sessions, local terminal sessions, whatever
More documentation
Please see the documentation for a complete list of commands.
Examples
Show a list of commands.
> \helpRun date every 5 seconds until the output contains 02
> date
> \repeat
> \await 02Within a debugger session, send next every 2 seconds.
> next
> \repeat 2Search the command history for the last occurrence of 'User' using fzf (readline command history works too)
> \find UserSearch the output for "http"
> \grep httpSend a local file named bigfile.rb to a remote rails console
> \send bigfile.rbSame thing, but throttle the copy-paste operation, sending 1 line per second:
> \delay 1
> \send bigfile.rbSimilar, but send it to an ssh console by first tarring and base64 encoding and not echoing stdout, and note that 'something' can also be a directory:
> \xfer somethingRun a command locally, sending each line of output to the remote console:
> \do echo dateRun a shell snippet locally, sending each line of output to the remote console:
> \dosh for i in `seq 5`; do echo "ping host-$i"; doneStart printing the numbers 1 through 100, one per second, but send a ctrl-c when the number 10 is printed:
> \enq \stop
queue is now : \stop
> for i in `seq 100`; do echo $i; sleep 1; done
# .. starts running in other pane ...
> \await 10
Waiting for "10"
Then I will send:
\stop
Done: saw "10"
starting enqueued command: \stopAdd an alias cat which cats a local file
\alias cat \shell catShow a local file (do not send it to the other pane) using the above alias
\cat myfileEdit a file named session.rb, in ~/.tmeta/scripts
\edit session.rbAfter running the above, add this to session.rb:
irb
\expect irb(main):001:0>
"hello world"
\expect irb(main):002:0>
exitNow running
\run session.rbwill start the interactive ruby console (irb) and the following session should take place on the top panel:
$ irb
irb(main):001:0> "hello world"
=> "hello world"
irb(main):002:0> exit
$Installation
Prerequisites: fzf, tmux, libreadline, raku and a few modules
On OS/X
brew install fzf
brew install tmux
brew install rakudo
zef install https://github.com/bduggan/tmeta.gitYou can also install raku with rakubrew
and then use zef to install tmeta.
See also
The documentation, with links to the source
The same documentation as shown by the
\helpcommandThis blog article: https://blog.matatu.org/raku-tmeta