Categorygithub.com/minefuto/tp
repositorypackage
1.0.0
Repository: https://github.com/minefuto/tp.git
Documentation: pkg.go.dev

# README

Transparent Pipe(tp)

Go Report Card build GitHub release (latest by date) GitHub go.mod Go version GitHub

This project is inspired by akavel/up.
tp is a terminal-based application for display the result of the commands at every keystroke.
Make it easy to chain commands for such as string manipulation.

It provides two displays.

  1. stdout from last pipe.
  2. live preview of the command result.

Shell integration

It can be synchronized shell's linebuffer and tp's inputfield.
The below config is the zsh integration.
keymappings: ctrl + |

function transparent-pipe() {
  BUFFER="$(tp -c "${BUFFER}|")"
  CURSOR=$#BUFFER
}
zle -N transparent-pipe
bindkey "^|" transparent-pipe

Limitation

tp executes the command at every keystroke. There is possibility to execute dangerous commands such as rm.
So, tp is only supported specific string manipulation commands. Any other commands will be executed when you pressed |, not every keystroke.
Also, tp is not supported redirections(<, >).

supported commands:
awk,cut,egrep,grep,head,jq,nl,sed,sort,tail,tr,uniq,vgrep,wc,yq

Installation

$ go install github.com/minefuto/tp@latest

Keybindings

operationkey
Move left(one char) / Ctrl-B
Move right(one char) / Ctrl-F
Move left(one word)Alt← / Alt-B
Move right(one word)Alt→ / Alt-F
Move begin of the lineHome / Ctrl-A
Move end of the lineEnd / Ctrl-E
Delete one char before the cursorBackspace / Ctrl-H
Delete one char after the cursorDelete / Ctrl-D
Delete one word before the cursorCtrl-W
Delete from the cursor to end of the lineCtrl-K
Delete all lineCtrl-U

Options

> tp -h
Usage of tp:
  -c, --command        Return commandline text
  -h, --help           Show help
  -s, --shell string   Select a shell to use (default "$SHELL")
  -v, --version        Show version

Supported OS

macOS, Linux