- Yes, young padawan.
$ cargo search bat
bat = "0.23.0" # A cat(1) clone with wings.
- But master, what is a cargo?
$ cargo --help |any install rust
Rust's package manager
--list List installed commands
--explain <CODE> Run `rustc --explain CODE`
install Install a Rust binary. Default location is $HOME/.cargo/bin
uninstall Uninstall a Rust binary
$ cargo install bat
(...)
master: This happens if you try and bat a binary.
$ bat `which bat`
[bat warning]: Binary content from file '/home/jaroslav/.cargo/bin/bat'
will not be printed to the terminal (but will be present if the output
of 'bat' is piped). You can use 'bat -A' to show the binary file contents.
- padawan: Are there any downsides to bat, master?
- master: Yes, it can be slow on large files, but that is partially because it does highlighting of structured syntax. That stuff can be disabled e.g. --style=plain --color=never
- padawan: What about the weird characters that cat outputs to the terminal then, master?
- master: _That happens because terminals will happily accept and interpret anything that looks like an ANSI escape code (internal terminal command) and try to do what the command says, if that command is implemented. For a brief intro, check out this list of ansi color escape sequencesThat happens because terminals will happily accept and interpret anything that looks like an ANSI escape code (internal terminal command) and try to do what the command says, if that command is implemented. For a brief intro, check out this list of ansi color escape sequences
Here is how to reproduce this behavior:
$ echo -ne "\u1B\u5B\u63" | xxd
00000000: 1b5b 63 .[c
$ echo -ne "\u1B\u5B\u63"
^[[?1;2c
$ 1;2c