From d6c8fee04419cf6fb69e51fd62aacc32f83bfef8 Mon Sep 17 00:00:00 2001 From: Aankhen Date: Sat, 8 Sep 2018 14:01:33 +0530 Subject: [PATCH 1/8] README.md: Add `Using bat on Windows` --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 8485491d..0638911f 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ or install it with [scoop](https://scoop.sh/): scoop install bat ``` +[See below](#using-bat-on-windows) for notes. + ### From binaries Check out the [Release page](https://github.com/sharkdp/bat/releases) for @@ -235,6 +237,28 @@ script as a wrapper, for example: less --tabs 4 -RF "$@" ``` +## Using `bat` on Windows + +`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration. + +### Paging + +Windows only includes a very limited pager in the form of `more`. You can download a Windows binary +for `less` [from its homepage](http://www.greenwoodsoftware.com/less/download.html) or [through +Chocolatey](https://chocolatey.org/packages/Less). To use it, place the binary in a directory in +your `PATH` or [define an environment variable](#using-a-different-pager). + +### Colours + +Windows 10 natively supports colours in both `conhost.exe` (Command Prompt) and PowerShell since +[v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)), as +well as in newer versions of bash. On earlier versions of Windows, you can use +[Cmder](http://cmder.net/), which includes [ConEmu](https://conemu.github.io/). + +**Note:** The Git and MSYS versions of `less` do not correctly interpret colours on Windows. If you +don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never` +or by setting `BAT_PAGER` to an empty string. + ## Troubleshooting ### Terminals & colors From 1b6df8a4802cd4580f515cf63756dad1649290fe Mon Sep 17 00:00:00 2001 From: rachitchokshi Date: Sat, 8 Sep 2018 14:23:14 -0700 Subject: [PATCH 2/8] Enabled build target aarch64-unknown-linux-gnu for arm64 architecture --- .travis.yml | 8 +++++++- Cargo.toml | 1 + ci/before_install.bash | 8 ++++++++ ci/script.bash | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28478f22..100f54fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,13 @@ matrix: - TARGET=arm-unknown-linux-gnueabihf - CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8 - CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8 - + - os: linux + rust: stable + env: + - TARGET=aarch64-unknown-linux-gnu + - CC_aarch64-unknown-linux-gnu=/usr/bin/aarch64-linux-gnu-gcc-4.8 + - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-4.8 + # Minimum Rust supported channel. - os: linux rust: 1.26.0 diff --git a/Cargo.toml b/Cargo.toml index ac395507..4df621ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ ansi_term = "0.11" console = "0.6" directories = "1.0" lazy_static = "1.0" +libz-sys = "1.0.20" [dependencies.git2] version = "0.7" diff --git a/ci/before_install.bash b/ci/before_install.bash index 709be7d5..9acf6025 100755 --- a/ci/before_install.bash +++ b/ci/before_install.bash @@ -27,3 +27,11 @@ if [[ $TARGET == arm-unknown-linux-gnueabihf ]]; then libc6-armhf-cross \ libc6-dev-armhf-cross fi + +# needed for cross-compiling for arm64 +if [[ $TARGET == aarch64-unknown-linux-gnu ]]; then + sudo apt-get install -y \ + gcc-4.8-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu \ + gcc-aarch64-linux-gnu +fi diff --git a/ci/script.bash b/ci/script.bash index 321dcb14..fc874b96 100755 --- a/ci/script.bash +++ b/ci/script.bash @@ -6,7 +6,7 @@ set -ex cargo build --target "$TARGET" --verbose # We cannot run arm executables on linux -if [[ $TARGET != arm-unknown-linux-gnueabihf ]]; then +if [[ $TARGET != arm-unknown-linux-gnueabihf ]] && [[ $TARGET != aarch64-unknown-linux-gnu ]]; then cargo test --target "$TARGET" --verbose # Run 'bat' on its own source code and the README From e9681bf22dd3aedd1ae479df0293cb97e32b49c4 Mon Sep 17 00:00:00 2001 From: rachitchokshi Date: Sun, 9 Sep 2018 01:15:41 -0700 Subject: [PATCH 3/8] Testing build by removing dependency 'libz-sys = "1.0.20"' --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4df621ac..ac395507 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,6 @@ ansi_term = "0.11" console = "0.6" directories = "1.0" lazy_static = "1.0" -libz-sys = "1.0.20" [dependencies.git2] version = "0.7" From 89d4cb951a2232a60891b14a79047a37d66c585e Mon Sep 17 00:00:00 2001 From: rachitchokshi Date: Sun, 9 Sep 2018 16:56:39 -0700 Subject: [PATCH 4/8] Updated before_deploy.bash to call version of strip specific to aarch64 target --- ci/before_deploy.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/before_deploy.bash b/ci/before_deploy.bash index ea5c1725..7cc4d874 100755 --- a/ci/before_deploy.bash +++ b/ci/before_deploy.bash @@ -19,6 +19,8 @@ pack() { if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then gcc_prefix="arm-linux-gnueabihf-" + elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then + gcc_prefix="aarch64-linux-gnu-" else gcc_prefix="" fi From 0fe3badf19a2e05c2b5cdde8bf748c393aab91c7 Mon Sep 17 00:00:00 2001 From: rachitchokshi <36342425+rachitchokshi@users.noreply.github.com> Date: Sun, 9 Sep 2018 19:30:29 -0700 Subject: [PATCH 5/8] adding deb packaging for arm64 (#1) --- ci/before_deploy.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/before_deploy.bash b/ci/before_deploy.bash index 7cc4d874..913fce44 100755 --- a/ci/before_deploy.bash +++ b/ci/before_deploy.bash @@ -51,13 +51,20 @@ make_deb() { local version local dpkgname local conflictname + local gcc_prefix case $TARGET in x86_64*) architecture=amd64 + gcc_prefix="" ;; i686*) architecture=i386 + gcc_prefix="" + ;; + aarch64*) + architecture=arm64 + gcc_prefix="aarch64-linux-gnu-" ;; *) echo "make_deb: skipping target '${TARGET}'" >&2 @@ -77,7 +84,7 @@ make_deb() { # copy the main binary install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME" - strip "$tempdir/usr/bin/$PROJECT_NAME" + "${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME" # manpage install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1" From e1ecc17f69f1d84fb127203a45e4abd88babab07 Mon Sep 17 00:00:00 2001 From: Rogach Date: Mon, 10 Sep 2018 22:36:58 +0300 Subject: [PATCH 6/8] print additional newline if last line in input file was not terminated with a newline (fixes #299) --- src/printer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/printer.rs b/src/printer.rs index afa2ac8b..10a44fba 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -243,6 +243,10 @@ impl<'a> Printer for InteractivePrinter<'a> { )).collect::>() .join("") )?; + + if line.bytes().next_back() != Some(b'\n') { + write!(handle, "\n")?; + } } else { for &(style, region) in regions.iter() { let mut ansi_iterator = AnsiCodeIterator::new(region); From f0d936763c552c3c5ca913333c0aef3a9d43900d Mon Sep 17 00:00:00 2001 From: rachitchokshi <36342425+rachitchokshi@users.noreply.github.com> Date: Tue, 11 Sep 2018 12:03:53 -0700 Subject: [PATCH 7/8] provide armhf deb packages (#301) * Enabled deb packaging for armhf architecture closes #280. --- ci/before_deploy.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/before_deploy.bash b/ci/before_deploy.bash index 913fce44..16cb261c 100755 --- a/ci/before_deploy.bash +++ b/ci/before_deploy.bash @@ -66,6 +66,10 @@ make_deb() { architecture=arm64 gcc_prefix="aarch64-linux-gnu-" ;; + arm*hf) + architecture=armhf + gcc_prefix="arm-linux-gnueabihf-" + ;; *) echo "make_deb: skipping target '${TARGET}'" >&2 return 0 From 4e3ab4d39915979592c23318bbdb9b5c43b7b9ea Mon Sep 17 00:00:00 2001 From: shik Chen Date: Tue, 11 Sep 2018 14:47:49 +0800 Subject: [PATCH 8/8] Query git diff only when needed In large git repo like chromium, it takes too long time to query git diff. --- src/printer.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index 10a44fba..552c0869 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -113,9 +113,13 @@ impl<'a> InteractivePrinter<'a> { } // Get the Git modifications - let line_changes = match file { - InputFile::Ordinary(filename) => get_git_diff(filename), - _ => None, + let line_changes = if config.output_components.changes() { + match file { + InputFile::Ordinary(filename) => get_git_diff(filename), + _ => None, + } + } else { + None }; // Determine the type of syntax for highlighting