Skip to content

Latest commit

 

History

History
70 lines (60 loc) · 3.11 KB

README.md

File metadata and controls

70 lines (60 loc) · 3.11 KB

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

operation key
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 line Home / Ctrl-A
Move end of the line End / Ctrl-E
Delete one char before the cursor Backspace / Ctrl-H
Delete one char after the cursor Delete / Ctrl-D
Delete one word before the cursor Ctrl-W
Delete from the cursor to end of the line Ctrl-K
Delete all line Ctrl-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