Skip to content

Commit 405efe5

Browse files
committed
update README.md
1 parent 6a01212 commit 405efe5

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# tp - Transparent Pipeline
2-
![GitHub](https://img.shields.io/github/license/minefuto/tp?style=for-the-badge)
2+
![build](https://img.shields.io/github/workflow/status/minefuto/tp/build?style=for-the-badge)
3+
![license](https://img.shields.io/github/license/minefuto/tp?style=for-the-badge)
34

45
This is a tool that interactively previews the command's stdin/stdout.
56

@@ -11,33 +12,53 @@ $ go install
1112
```
1213

1314
## Usage
14-
### 1. stdin/stdout mode
15+
### 1. commandline mode
1516
<img src="https://github.com/minefuto/tp/blob/main/gif/mode1.gif">
1617

17-
### 2. commandline mode
18-
<img src="https://github.com/minefuto/tp/blob/main/gif/mode2.gif">
19-
2018
Add the following to shell's config file.
19+
`<key>`: Specify any key.
20+
**Bash(`.bashrc`)**
21+
```
22+
function transparent-pipeline() {
23+
READLINE_LINE=$(tp -c "${READLINE_LINE}|")
24+
READLINE_POINT=${#READLINE_LINE}
25+
}
26+
bind -x '"<key>": transparent-pipeline'
27+
```
2128
**Zsh(`.zshrc`)**
2229
```
2330
function transparent-pipeline() {
24-
BUFFER="$(tp -c $BUFFER)"
31+
BUFFER="$(tp -c "${BUFFER}|")"
2532
CURSOR=$#BUFFER
2633
}
2734
zle -N transparent-pipeline
28-
bindkey '^t' transparent-pipeline
35+
bindkey "<key>" transparent-pipeline
2936
```
30-
3137
**Fish(`config.fish`)**
3238
```
3339
function transparent-pipeline
3440
commandline | read -l buffer
35-
commandline (tp -c "$buffer")
41+
commandline -r (tp -c "$buffer|")
42+
commandline -f repaint
3643
end
3744
function fish_user_key_bindings
38-
bind \ct transparent-pipeline
45+
bind "<key>" transparent-pipeline
3946
end
4047
```
4148

49+
### 2. stdin/stdout mode
50+
<img src="https://github.com/minefuto/tp/blob/main/gif/mode2.gif">
51+
52+
## Options
53+
```
54+
> tp -h
55+
Usage of tp:
56+
-c, --command Return commandline text (Please see the "1. commandline mode")
57+
-h, --help Show help
58+
--horizontal Split the view horizontally
59+
-s, --shell string Specify the shell to use (default "$SHELL")
60+
-v, --version Show version
61+
```
62+
4263
## Supported OS
4364
macOS, Linux

gif/mode1.gif

730 KB
Loading

gif/mode2.gif

29.4 KB
Loading

0 commit comments

Comments
 (0)