mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 10:52:24 +01:00
Merge branch 'master' of github.com:sharkdp/bat into string-input
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
|
||||
- Add padding above headers when not using a grid, see #968 and #981 (@pt2121)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- bat mishighlights Users that start with digits in SSH config, see #984
|
||||
|
||||
## Other
|
||||
## New syntaxes
|
||||
## New themes
|
||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -114,7 +114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bat"
|
||||
version = "0.15.0"
|
||||
version = "0.15.1"
|
||||
dependencies = [
|
||||
"ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.15.0"
|
||||
version = "0.15.1"
|
||||
exclude = [
|
||||
"assets/syntaxes/*",
|
||||
"assets/themes/*",
|
||||
|
14
README.md
14
README.md
@@ -168,7 +168,7 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
||||
|
||||
[](https://repology.org/project/bat/versions)
|
||||
|
||||
### On Ubuntu
|
||||
### On Ubuntu (using `apt`)
|
||||
*... and other Debian-based Linux distributions.*
|
||||
|
||||
`bat` is making its way through the [Ubuntu](https://packages.ubuntu.com/eoan/bat) and
|
||||
@@ -182,12 +182,22 @@ If your Ubuntu/Debian installation is new enough you can simply run:
|
||||
apt install bat
|
||||
```
|
||||
|
||||
If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||
clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distrutions:
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
### On Ubuntu (using most recent `.deb` packages)
|
||||
*... and other Debian-based Linux distributions.*
|
||||
|
||||
If the package has not yet been promoted to your Ubuntu/Debian installation, or you want
|
||||
the most recent release of `bat`, download the latest `.deb` package from the
|
||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/Elixir
vendored
2
assets/syntaxes/02_Extra/Elixir
vendored
Submodule assets/syntaxes/02_Extra/Elixir updated: 89b3bada32...1f010d5f63
2
assets/syntaxes/02_Extra/Elm
vendored
2
assets/syntaxes/02_Extra/Elm
vendored
Submodule assets/syntaxes/02_Extra/Elm updated: dfbb8bdc9a...e266d279c8
2
assets/syntaxes/02_Extra/Email
vendored
2
assets/syntaxes/02_Extra/Email
vendored
Submodule assets/syntaxes/02_Extra/Email updated: fc034fb85a...ee3e68fce2
2
assets/syntaxes/02_Extra/Julia
vendored
2
assets/syntaxes/02_Extra/Julia
vendored
Submodule assets/syntaxes/02_Extra/Julia updated: 0ca4cc2990...6c0d770fc7
2
assets/syntaxes/02_Extra/ssh-config
vendored
2
assets/syntaxes/02_Extra/ssh-config
vendored
Submodule assets/syntaxes/02_Extra/ssh-config updated: 16e19d5da4...3ec06d0e9c
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
2
assets/themes/Solarized
vendored
2
assets/themes/Solarized
vendored
Submodule assets/themes/Solarized updated: 87e01090cf...3707f68ddc
2
assets/themes/dracula-sublime
vendored
2
assets/themes/dracula-sublime
vendored
Submodule assets/themes/dracula-sublime updated: 811a634420...26c57ec282
2
assets/themes/onehalf
vendored
2
assets/themes/onehalf
vendored
Submodule assets/themes/onehalf updated: fdcbffe317...970abdf26b
@@ -180,7 +180,7 @@ apt install bat
|
||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||
次の方法でインストールします:
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
|
@@ -170,7 +170,7 @@ apt install bat
|
||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
|
@@ -75,7 +75,7 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
};
|
||||
|
||||
for input in inputs.into_iter() {
|
||||
for (index, input) in inputs.into_iter().enumerate() {
|
||||
match input.open(io::stdin().lock()) {
|
||||
Err(error) => {
|
||||
print_error(&error, writer);
|
||||
@@ -128,6 +128,7 @@ impl<'b> Controller<'b> {
|
||||
&mut *printer,
|
||||
writer,
|
||||
&mut opened_input,
|
||||
index != 0,
|
||||
#[cfg(feature = "git")]
|
||||
&line_changes,
|
||||
);
|
||||
@@ -148,10 +149,11 @@ impl<'b> Controller<'b> {
|
||||
printer: &mut dyn Printer,
|
||||
writer: &mut dyn Write,
|
||||
input: &mut OpenedInput,
|
||||
add_header_padding: bool,
|
||||
#[cfg(feature = "git")] line_changes: &Option<LineChanges>,
|
||||
) -> Result<()> {
|
||||
if !input.reader.first_line.is_empty() || self.config.style_components.header() {
|
||||
printer.print_header(writer, input)?;
|
||||
printer.print_header(writer, input, add_header_padding)?;
|
||||
}
|
||||
|
||||
if !input.reader.first_line.is_empty() {
|
||||
|
@@ -33,7 +33,12 @@ use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
||||
use crate::wrapping::WrappingMode;
|
||||
|
||||
pub(crate) trait Printer {
|
||||
fn print_header(&mut self, handle: &mut dyn Write, input: &OpenedInput) -> Result<()>;
|
||||
fn print_header(
|
||||
&mut self,
|
||||
handle: &mut dyn Write,
|
||||
input: &OpenedInput,
|
||||
add_header_padding: bool,
|
||||
) -> Result<()>;
|
||||
fn print_footer(&mut self, handle: &mut dyn Write, input: &OpenedInput) -> Result<()>;
|
||||
|
||||
fn print_snip(&mut self, handle: &mut dyn Write) -> Result<()>;
|
||||
@@ -56,7 +61,12 @@ impl SimplePrinter {
|
||||
}
|
||||
|
||||
impl Printer for SimplePrinter {
|
||||
fn print_header(&mut self, _handle: &mut dyn Write, _input: &OpenedInput) -> Result<()> {
|
||||
fn print_header(
|
||||
&mut self,
|
||||
_handle: &mut dyn Write,
|
||||
_input: &OpenedInput,
|
||||
_add_header_padding: bool,
|
||||
) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -219,7 +229,12 @@ impl<'a> InteractivePrinter<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Printer for InteractivePrinter<'a> {
|
||||
fn print_header(&mut self, handle: &mut dyn Write, input: &OpenedInput) -> Result<()> {
|
||||
fn print_header(
|
||||
&mut self,
|
||||
handle: &mut dyn Write,
|
||||
input: &OpenedInput,
|
||||
add_header_padding: bool,
|
||||
) -> Result<()> {
|
||||
if !self.config.style_components.header() {
|
||||
if Some(ContentType::BINARY) == self.content_type && !self.config.show_nonprintable {
|
||||
writeln!(
|
||||
@@ -248,6 +263,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
.paint(if self.panel_width > 0 { "│ " } else { "" }),
|
||||
)?;
|
||||
} else {
|
||||
if add_header_padding {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
write!(handle, "{}", " ".repeat(self.panel_width))?;
|
||||
}
|
||||
|
||||
|
@@ -615,7 +615,7 @@ fn filename_multiple_ok() {
|
||||
.arg("--file-name=bar")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("File: foo\nFile: bar\n")
|
||||
.stdout("File: foo\n\nFile: bar\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
@@ -632,6 +632,18 @@ fn filename_multiple_err() {
|
||||
.failure();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_padding() {
|
||||
bat()
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=header")
|
||||
.arg("test.txt")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.stdout("File: test.txt\nhello world\n\nFile: single-line.txt\nSingle Line\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn file_with_invalid_utf8_filename() {
|
||||
|
Reference in New Issue
Block a user