Skip to content

Commit bef1ef4

Browse files
committed
rename colines to coat, update docs
1 parent b5d7b84 commit bef1ef4

File tree

4 files changed

+48
-17
lines changed

4 files changed

+48
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/oldratlee/useful-scripts/m
4545

4646
1. [c](docs/shell.md#beer-c)
4747
原样命令行输出,并拷贝标准输出到系统剪贴板,省去`CTRL+C`操作,优化命令行与其它应用之间的操作流。
48-
1. [colines](docs/shell.md#beer-colines)
48+
1. [coat](docs/shell.md#beer-coat)
4949
彩色`cat`出文件行,方便人眼区分不同的行。
5050
1. [a2l](docs/shell.md#beer-a2l)
5151
按行彩色输出参数,方便人眼查看。

colines renamed to coat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
22
# @Function
3-
# cat lines colorfully. colines means COLorful LINES.
3+
# cat lines colorfully. coat means *CO*lorful c*AT*.
44
#
55
# @Usage
6-
# $ echo -n 'Hello\nWorld' | colines
7-
# $ colines /path/to/file1
8-
# $ colines /path/to/file1 /path/to/file2
6+
# $ echo -n 'Hello\nWorld' | coat
7+
# $ coat /path/to/file1
8+
# $ coat /path/to/file1 /path/to/file2
99
#
10-
# @online-doc https://github.com/oldratlee/useful-scripts/blob/master/docs/shell.md#beer-colines
10+
# @online-doc https://github.com/oldratlee/useful-scripts/blob/master/docs/shell.md#beer-coat
1111
# @author Jerry Lee (oldratlee at gmail dot com)
1212

1313
set -e

docs/coat.png

183 KB
Loading

docs/shell.md

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- [:beer: c](#beer-c)
1010
- [示例](#%E7%A4%BA%E4%BE%8B)
1111
- [参考资料](#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99)
12-
- [:beer: colines](#beer-colines)
12+
- [:beer: coat](#beer-coat)
1313
- [示例](#%E7%A4%BA%E4%BE%8B-1)
1414
- [:beer: a2l](#beer-a2l)
1515
- [示例](#%E7%A4%BA%E4%BE%8B-2)
@@ -80,36 +80,67 @@ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAz+ETZEgoLeIiC0rjWewdDs0sbo8c...== [email protected]
8080

8181
[拷贝复制命令行输出放在系统剪贴板上](http://oldratlee.com/post/2012-12-23/command-output-to-clip),给出了不同系统可用命令。
8282

83-
:beer: [colines](../colines)
83+
:beer: [coat](../coat)
8484
----------------------
8585

86-
彩色`cat`出文件行,方便人眼区分不同的行。
87-
支持`Linux``Mac``Windows``cygwin``MSSYS`)。
88-
命令支持选项、功能和使用方式与[`cat`命令](https://linux.die.net/man/1/cat)完全一样(实际上在实现上全部代码给`cat`命令)。
86+
彩色`cat`出文件行,方便人眼区分不同的行。
87+
支持`Linux``Mac``Windows``cygwin``MSSYS`)。
88+
89+
命令支持选项、功能和使用方式与[`cat`命令](https://linux.die.net/man/1/cat)完全一样(实际上读流操作在实现上全部代理给`cat`命令)。
8990

90-
命令名`colines`意思是`COLorful LINES`
91+
命令名`coat`意思是`COlorful cAT`;当然单词`coat`的意思是外套,彩色输入行就像件漂亮的外套~ :satisfied:
9192

9293
### 示例
9394

9495
```bash
95-
$ echo a | colines
96+
$ echo a | coat
9697
a
97-
$ echo -e 'a\nb' | colines
98+
$ echo -e 'a\nb' | coat
9899
a
99100
b
100-
$ echo -e 'a\nb' | nl | colines
101+
$ echo -e 'a\nb' | nl | coat
101102
1 a
102103
2 b
103-
$ colines file1 file2.txt
104+
$ coat file1 file2.txt
104105
line1 of file1
105106
line2 of file1
106107
...
107108
line1 of file2
108109
line2 of file2
109110
...
111+
112+
# 帮助信息
113+
# 可以看到本人机器上实现代理的`cat`命令是GNU的实现。
114+
$ coat --help
115+
Usage: cat [OPTION]... [FILE]...
116+
Concatenate FILE(s) to standard output.
117+
118+
With no FILE, or when FILE is -, read standard input.
119+
120+
-A, --show-all equivalent to -vET
121+
-b, --number-nonblank number nonempty output lines, overrides -n
122+
-e equivalent to -vE
123+
-E, --show-ends display $ at end of each line
124+
-n, --number number all output lines
125+
-s, --squeeze-blank suppress repeated empty output lines
126+
-t equivalent to -vT
127+
-T, --show-tabs display TAB characters as ^I
128+
-u (ignored)
129+
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
130+
--help display this help and exit
131+
--version output version information and exit
132+
133+
Examples:
134+
cat f - g Output f's contents, then standard input, then g's contents.
135+
cat Copy standard input to standard output.
136+
137+
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
138+
Full documentation at: <http://www.gnu.org/software/coreutils/cat>
139+
or available locally via: info '(coreutils) cat invocation'
110140
```
111141

112-
注:上面显示中,没有彩色,在控制台上运行可以看出彩色效果。
142+
注:上面示例中,没有彩色;在控制台上运行可以看出彩色效果,如下:
143+
![](../docs/coat.png)
113144

114145
:beer: [a2l](../a2l)
115146
----------------------

0 commit comments

Comments
 (0)