Skip to content

Commit

Permalink
rename colines to coat, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Oct 23, 2017
1 parent b5d7b84 commit bef1ef4
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/oldratlee/useful-scripts/m

1. [c](docs/shell.md#beer-c)
原样命令行输出,并拷贝标准输出到系统剪贴板,省去`CTRL+C`操作,优化命令行与其它应用之间的操作流。
1. [colines](docs/shell.md#beer-colines)
1. [coat](docs/shell.md#beer-coat)
彩色`cat`出文件行,方便人眼区分不同的行。
1. [a2l](docs/shell.md#beer-a2l)
按行彩色输出参数,方便人眼查看。
Expand Down
10 changes: 5 additions & 5 deletions colines → coat
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
# @Function
# cat lines colorfully. colines means COLorful LINES.
# cat lines colorfully. coat means *CO*lorful c*AT*.
#
# @Usage
# $ echo -n 'Hello\nWorld' | colines
# $ colines /path/to/file1
# $ colines /path/to/file1 /path/to/file2
# $ echo -n 'Hello\nWorld' | coat
# $ coat /path/to/file1
# $ coat /path/to/file1 /path/to/file2
#
# @online-doc https://github.com/oldratlee/useful-scripts/blob/master/docs/shell.md#beer-colines
# @online-doc https://github.com/oldratlee/useful-scripts/blob/master/docs/shell.md#beer-coat
# @author Jerry Lee (oldratlee at gmail dot com)

set -e
Expand Down
Binary file added docs/coat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 42 additions & 11 deletions docs/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [:beer: c](#beer-c)
- [示例](#%E7%A4%BA%E4%BE%8B)
- [参考资料](#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99)
- [:beer: colines](#beer-colines)
- [:beer: coat](#beer-coat)
- [示例](#%E7%A4%BA%E4%BE%8B-1)
- [:beer: a2l](#beer-a2l)
- [示例](#%E7%A4%BA%E4%BE%8B-2)
Expand Down Expand Up @@ -80,36 +80,67 @@ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAz+ETZEgoLeIiC0rjWewdDs0sbo8c...== [email protected]

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

:beer: [colines](../colines)
:beer: [coat](../coat)
----------------------

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

命令支持选项、功能和使用方式与[`cat`命令](https://linux.die.net/man/1/cat)完全一样(实际上读流操作在实现上全部代理给`cat`命令)。

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

### 示例

```bash
$ echo a | colines
$ echo a | coat
a
$ echo -e 'a\nb' | colines
$ echo -e 'a\nb' | coat
a
b
$ echo -e 'a\nb' | nl | colines
$ echo -e 'a\nb' | nl | coat
1 a
2 b
$ colines file1 file2.txt
$ coat file1 file2.txt
line1 of file1
line2 of file1
...
line1 of file2
line2 of file2
...

# 帮助信息
# 可以看到本人机器上实现代理的`cat`命令是GNU的实现。
$ coat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

-A, --show-all equivalent to -vET
-b, --number-nonblank number nonempty output lines, overrides -n
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-n, --number number all output lines
-s, --squeeze-blank suppress repeated empty output lines
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-u (ignored)
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
--help display this help and exit
--version output version information and exit

Examples:
cat f - g Output f's contents, then standard input, then g's contents.
cat Copy standard input to standard output.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'
```

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

:beer: [a2l](../a2l)
----------------------
Expand Down

0 comments on commit bef1ef4

Please sign in to comment.