84 lines
2.2 KiB
Markdown
84 lines
2.2 KiB
Markdown
# bat
|
|
|
|
Remplaçant de cat
|
|
|
|
https://github.com/sharkdp/bat
|
|
|
|
|
|
|
|
Installation:
|
|
|
|
```bash
|
|
$ brew install bat
|
|
$ brew install fzf
|
|
```
|
|
|
|
Créer le fichier de configuration:
|
|
|
|
```bash
|
|
$ bat --generate-config-file
|
|
```
|
|
|
|
Editer la configuration:
|
|
|
|
```bash
|
|
$ nano /Users/bruno/.config/bat/config
|
|
```
|
|
|
|
Prévisualiser les thèmes:
|
|
|
|
```bash
|
|
$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"
|
|
```
|
|
|
|
Tail et bat:
|
|
|
|
```bash
|
|
$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log
|
|
|
|
STDIN
|
|
1 [Fri Nov 27 16:15:38.788043 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
|
2 [Fri Nov 27 16:22:54.224576 2020] [mpm_prefork:notice] [pid 10014] AH00173: SIGHUP received. Attempting to restart
|
|
3 [Fri Nov 27 16:22:54.278764 2020] [mpm_prefork:notice] [pid 10014] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1h PHP/8.0.0 configured -- resuming normal operations
|
|
4 [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
|
```
|
|
|
|
Find et bat:
|
|
|
|
```bash
|
|
$ find /usr -name error_log -exec bat {} +
|
|
|
|
-rw-r--r-- 1 root wheel 0 Oct 18 2019 rmtab
|
|
File: /usr/local/var/log/httpd/error_log
|
|
1 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using SilverBook.local. Set the 'ServerName' directive globally to suppress this message
|
|
2 [Tue Aug 06 11:06:14.901395 2019] [mpm_prefork:notice] [pid 51047] AH00163: Apache/2.4.39 (Unix) configured -- resuming normal operations
|
|
3 [Tue Aug 06 11:06:14.904904 2019] [core:notice] [pid 51047] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
|
|
|
|
```
|
|
|
|
Man pages:
|
|
|
|
```bash
|
|
$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
|
man 2 select
|
|
```
|
|
|
|
|
|
|
|
## bat-extras
|
|
|
|
https://github.com/eth-p/bat-extras/blob/master/README.md#installation
|
|
|
|
```bash
|
|
$ brew install eth-p/software/bat-extras
|
|
```
|
|
|
|
[batman](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)
|
|
|
|
[batgrep](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md)
|
|
|
|
[batwatch](https://github.com/eth-p/bat-extras/blob/master/doc/batwatch.md)
|
|
|
|
[batdiff](https://github.com/eth-p/bat-extras/blob/master/doc/batdiff.md)
|
|
|