mirror of
https://github.com/sharkdp/bat
synced 2024-11-15 16:38:06 +00:00
Merge remote-tracking branch 'origin/master' into fix-1063
This commit is contained in:
commit
cc0f8ca813
52 changed files with 422 additions and 710 deletions
29
.github/workflows/CICD.yml
vendored
29
.github/workflows/CICD.yml
vendored
|
@ -22,6 +22,12 @@ jobs:
|
|||
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
||||
default: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
components: clippy
|
||||
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --all-targets --all-features
|
||||
- name: Test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
|
@ -152,6 +158,8 @@ jobs:
|
|||
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
||||
# deployable tag? (ie, leading "vM" or "M"; M == version number)
|
||||
unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi
|
||||
# unset deploy on ubuntu-18.04 x64 - we will deploy the tarball/deb built on ubuntu-16.04 x64
|
||||
if [ "${{ matrix.job.os }}" = "ubuntu-18.04" ] && [ "${{ matrix.job.target }}" = "x86_64-unknown-linux-gnu" ]; then unset DEPLOY; fi
|
||||
echo set-output name=DEPLOY::${DEPLOY:-<empty>/false}
|
||||
echo ::set-output name=DEPLOY::${DEPLOY}
|
||||
# DPKG architecture?
|
||||
|
@ -274,6 +282,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
ARCHIVE_DIR='${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/'
|
||||
COPYRIGHT_YEARS="2018 - "$(date "+%Y")
|
||||
# Binary
|
||||
cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "$ARCHIVE_DIR"
|
||||
|
||||
|
@ -283,8 +292,8 @@ jobs:
|
|||
# Man page
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "$ARCHIVE_DIR"
|
||||
|
||||
# README and LICENSE files
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "$ARCHIVE_DIR"
|
||||
# README, LICENSE and CHANGELOG files
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
||||
|
||||
# Autocompletion files
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||
|
@ -308,24 +317,27 @@ jobs:
|
|||
|
||||
# Man page
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
gzip --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
|
||||
# Autocompletion files
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
||||
|
||||
# README and LICENSE
|
||||
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-MIT"
|
||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-APACHE"
|
||||
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-MIT"
|
||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-APACHE"
|
||||
install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
||||
gzip -n --best "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
||||
|
||||
cat > "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/copyright" <<EOF
|
||||
cat > "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright" <<EOF
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: ${{ env.PROJECT_NAME }}
|
||||
Source: ${{ env.PROJECT_HOMEPAGE }}
|
||||
|
||||
Files: *
|
||||
Copyright: ${{ env.PROJECT_MAINTAINER }}
|
||||
Copyright: $COPYRIGHT_YEARS ${{ env.PROJECT_MAINTAINER }}
|
||||
License: Apache-2.0 or MIT
|
||||
|
||||
License: Apache-2.0
|
||||
|
@ -357,6 +369,7 @@ jobs:
|
|||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
EOF
|
||||
chmod 644 "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright"
|
||||
|
||||
# control file
|
||||
mkdir -p "${DPKG_DIR}/DEBIAN"
|
||||
|
@ -370,7 +383,7 @@ jobs:
|
|||
Architecture: ${{ steps.vars.outputs.DPKG_ARCH }}
|
||||
Provides: ${{ env.PROJECT_NAME }}
|
||||
Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }}
|
||||
Description: A cat(1) clone with wings.
|
||||
Description: cat(1) clone with wings.
|
||||
A cat(1) clone with syntax highlighting and Git integration.
|
||||
EOF
|
||||
|
||||
|
|
7
.gitmodules
vendored
7
.gitmodules
vendored
|
@ -185,9 +185,6 @@
|
|||
[submodule "assets/syntaxes/02_Extra/AsciiDoc"]
|
||||
path = assets/syntaxes/02_Extra/AsciiDoc
|
||||
url = https://github.com/asciidoctor/sublimetext-asciidoc.git
|
||||
[submodule "assets/themes/gruvbox"]
|
||||
path = assets/themes/gruvbox
|
||||
url = https://github.com/peaceant/gruvbox.git
|
||||
[submodule "assets/syntaxes/02_Extra/GLSL"]
|
||||
path = assets/syntaxes/02_Extra/GLSL
|
||||
url = https://github.com/euler0/sublime-glsl
|
||||
|
@ -206,3 +203,7 @@
|
|||
[submodule "assets/themes/Coldark"]
|
||||
path = assets/themes/Coldark
|
||||
url = https://github.com/ArmandPhilippot/coldark-bat.git
|
||||
[submodule "assets/themes/gruvbox"]
|
||||
path = assets/themes/gruvbox
|
||||
url = https://github.com/subnut/gruvbox-tmTheme.git
|
||||
branch = bat-source
|
||||
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -2,27 +2,41 @@
|
|||
|
||||
|
||||
## Features
|
||||
- Use a pager when `bat --list-languages` is called, see #1394 (@stku1985)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- If the last line doesn't end with a newline character, don't add it if `--style=plain`, see #1438 (@Enselic)
|
||||
- Only print themes hint in interactive mode (`bat --list-themes`), see #1439 (@rsteube)
|
||||
- Make ./tests/syntax-tests/regression_test.sh work on recent versions of macOS, see #1443 (@Enselic)
|
||||
- VimL syntax highlighting fix, see #1450 (@esensar)
|
||||
- Ignore PAGER=most by default with a warning to stderr, but allow override with BAT_PAGER or --config, see #1063 (@Enselic)
|
||||
|
||||
## Other
|
||||
|
||||
- Performance improvements, see #1421 (@LovecraftianHorror)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
## New themes
|
||||
|
||||
- `ansi` replaces `ansi-dark` and `ansi-light`, see #1104 and #1412 (@mk12)
|
||||
- The Gruvbox theme has been updated, see #1291 (@j0hnmeow). **Breaking change:** users that were previously usuing `gruvbox` or `gruvbox-white` should update and use `gruvbox-dark`/`gruvbox-light` instead.
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
## Packaging
|
||||
|
||||
- `bat` is now available on snapstore with package name called `batcat`, see #1401 (@purveshpatel511)
|
||||
|
||||
|
||||
# v0.17.1
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Running `bat` without arguments fails ("output file is also an input"), see #1396
|
||||
|
||||
|
||||
# v0.17.0
|
||||
|
||||
## Features
|
||||
|
|
|
@ -8,12 +8,12 @@ Thank you for considering to contribute to `bat`!
|
|||
|
||||
If your contribution changes the behavior of `bat` (as opposed to a typo-fix
|
||||
in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file
|
||||
and describe your changes. This makes the release proess much easier and
|
||||
and describe your changes. This makes the release process much easier and
|
||||
therefore helps to get your changes into a new `bat` release faster.
|
||||
|
||||
The top of the `CHANGELOG` contains a *"unreleased"* section with a few
|
||||
subsections (Features, Bugfixes, …). Please add your entry to the subsection
|
||||
that best describes your change
|
||||
that best describes your change.
|
||||
|
||||
Entries follow this format:
|
||||
```
|
||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -56,9 +56,9 @@ checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
|||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
|
||||
checksum = "3dc1679af9a1ab4bea16f228b05d18f8363f8327b1fa8db00d2760cfafc6b61e"
|
||||
dependencies = [
|
||||
"doc-comment",
|
||||
"predicates",
|
||||
|
|
|
@ -5,7 +5,6 @@ description="A cat(1) clone with wings."
|
|||
homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.17.1"
|
||||
exclude = [
|
||||
|
@ -74,7 +73,7 @@ default-features = false
|
|||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
assert_cmd = "1.0.1"
|
||||
assert_cmd = "1.0.2"
|
||||
predicates = "1.0.5"
|
||||
|
||||
[build-dependencies]
|
||||
|
|
25
README.md
25
README.md
|
@ -196,7 +196,7 @@ 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
|
||||
**Important**: 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 distributions:
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
|
@ -256,6 +256,13 @@ You can install `bat` via xbps-install:
|
|||
xbps-install -S bat
|
||||
```
|
||||
|
||||
### On Termux
|
||||
|
||||
You can install `bat` via pkg:
|
||||
```bash
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
### On FreeBSD
|
||||
|
||||
You can install a precompiled [`bat` package](https://www.freshports.org/textproc/bat) with pkg:
|
||||
|
@ -287,6 +294,15 @@ You can install `bat` with zypper:
|
|||
zypper install bat
|
||||
```
|
||||
|
||||
### Via snap package
|
||||
|
||||
```
|
||||
sudo snap install batcat
|
||||
```
|
||||
|
||||
[Get it from the Snap Store](https://snapcraft.io/batcat)
|
||||
|
||||
|
||||
### On macOS (or Linux) via Homebrew
|
||||
|
||||
You can install `bat` with [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) or [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat):
|
||||
|
@ -374,12 +390,11 @@ You can also use a custom theme by following the
|
|||
|
||||
### 8-bit themes
|
||||
|
||||
`bat` has four themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||
`bat` has three themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||
even when truecolor support is available:
|
||||
|
||||
- `ansi-dark` looks decent on any terminal with a dark background. It uses 3-bit colors: black, red,
|
||||
green, yellow, blue, magenta, cyan, and white.
|
||||
- `ansi-light` is like `ansi-dark`, but for terminals with a light background.
|
||||
- `ansi` looks decent on any terminal. It uses 3-bit colors: black, red, green,
|
||||
yellow, blue, magenta, cyan, and white.
|
||||
- `base16` is designed for [base16](https://github.com/chriskempson/base16) terminal themes. It uses
|
||||
4-bit colors (3-bit colors plus bright variants) in accordance with the
|
||||
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||
|
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/AWK
vendored
2
assets/syntaxes/02_Extra/AWK
vendored
|
@ -1 +1 @@
|
|||
Subproject commit e593eb6d42a5f1881ba6c75698bd0fb78a9b8871
|
||||
Subproject commit e23926eca1b6a0bd0b572b7191aead9f77c748d1
|
2
assets/syntaxes/02_Extra/GraphQL
vendored
2
assets/syntaxes/02_Extra/GraphQL
vendored
|
@ -1 +1 @@
|
|||
Subproject commit c9d84587eb1a6eb34457a875f21b9b1a29306be3
|
||||
Subproject commit 59304d6c7b5019091b532a3197251e393e1db7b2
|
2
assets/syntaxes/02_Extra/Svelte
vendored
2
assets/syntaxes/02_Extra/Svelte
vendored
|
@ -1 +1 @@
|
|||
Subproject commit bf92f5b7b69c8ea641d6822fd6d12cc2d9341956
|
||||
Subproject commit aee0676f379c0503f9c557e24aa2816575e0a4d1
|
2
assets/syntaxes/02_Extra/VimL
vendored
2
assets/syntaxes/02_Extra/VimL
vendored
|
@ -1 +1 @@
|
|||
Subproject commit ed40c3bc814cd0c8107dbbb8fcd95946b33217f0
|
||||
Subproject commit 23afc890977bb1fd43fd05e7d983f994993d4982
|
4
assets/syntaxes/02_Extra/VimL.sublime-syntax
vendored
4
assets/syntaxes/02_Extra/VimL.sublime-syntax
vendored
|
@ -75,10 +75,10 @@ contexts:
|
|||
- match: '''(''''|\n[^\S\n]*\\|[^\n''])*'''
|
||||
scope: string.quoted.single.viml
|
||||
string_regex:
|
||||
- match: '/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/'
|
||||
- match: '[gvs]{1}/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/'
|
||||
scope: string.regexp.viml
|
||||
support_function:
|
||||
- match: \b(set(local|global)?|let|command|filetype|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b
|
||||
- match: \b(set(local|global)?|let|command|filetype|syntax|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b
|
||||
scope: support.function.viml
|
||||
support_type:
|
||||
- match: <.*?>
|
||||
|
|
2
assets/syntaxes/02_Extra/ssh-config
vendored
2
assets/syntaxes/02_Extra/ssh-config
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 1ddcb320aca1bf31b0048a3109540475d5af64e2
|
||||
Subproject commit 201816b609abf7ccf583f7e888f6dc4121410d70
|
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
2
assets/themes/Coldark
vendored
2
assets/themes/Coldark
vendored
|
@ -1 +1 @@
|
|||
Subproject commit b4a1c74d8d5bdd136ec530e5905b810272472545
|
||||
Subproject commit e44750b2a9629dd12d8ed3ad9fd50c77232170b9
|
504
assets/themes/ansi-light.tmTheme
vendored
504
assets/themes/ansi-light.tmTheme
vendored
|
@ -1,504 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||
that this encoding is being used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
<key>name</key>
|
||||
<string>ANSI Light</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#07000000</string>
|
||||
<key>caret</key>
|
||||
<string>#00000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
<key>invisibles</key>
|
||||
<string>#00000000</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#00000000</string>
|
||||
<key>selection</key>
|
||||
<string>#00000000</string>
|
||||
<key>gutter</key>
|
||||
<string>#07000000</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Text</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comments</string>
|
||||
<key>scope</key>
|
||||
<string>comment, punctuation.definition.comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Delimiters</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Operators</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keywords</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variables</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Functions</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function, meta.require, support.function.any-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Labels</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.label</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>meta.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Methods</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.special-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Support</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Strings, Inherited Class</string>
|
||||
<key>scope</key>
|
||||
<string>string, constant.other.symbol, entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Integers</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Floats</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Boolean</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Constants</string>
|
||||
<key>scope</key>
|
||||
<string>constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tags</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attributes</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attribute IDs</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Selector</string>
|
||||
<key>scope</key>
|
||||
<string>meta.selector</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Values</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Units</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.unit</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Bold</string>
|
||||
<key>scope</key>
|
||||
<string>markup.bold, punctuation.definition.bold</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Italic</string>
|
||||
<key>scope</key>
|
||||
<string>markup.italic, punctuation.definition.italic</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Code</string>
|
||||
<key>scope</key>
|
||||
<string>markup.raw.inline</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Text</string>
|
||||
<key>scope</key>
|
||||
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Url</string>
|
||||
<key>scope</key>
|
||||
<string>meta.link</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Quotes</string>
|
||||
<key>scope</key>
|
||||
<string>markup.quote</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inserted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.inserted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Deleted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.deleted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Changed</string>
|
||||
<key>scope</key>
|
||||
<string>markup.changed</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Colors</string>
|
||||
<key>scope</key>
|
||||
<string>constant.other.color</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Regular Expressions</string>
|
||||
<key>scope</key>
|
||||
<string>string.regexp</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Escape Characters</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character.escape</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Embedded</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.section.embedded, variable.interpolation</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Illegal</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.illegal</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#01000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Broken</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.broken</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#03000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>uuid</key>
|
||||
<string>uuid</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -3,14 +3,14 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||
that this encoding is being used.
|
||||
The colors in this theme are encoded as #RRGGBBAA where:
|
||||
* If AA is 00, then RR is an ANSI palette number from 00 to 07.
|
||||
* If AA is 01, the terminal's default fg/bg color is used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
<key>name</key>
|
||||
<string>ANSI Dark</string>
|
||||
<string>ANSI</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>settings</key>
|
||||
|
@ -19,32 +19,17 @@
|
|||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#00000000</string>
|
||||
<key>caret</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
<key>invisibles</key>
|
||||
<string>#07000000</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#07000000</string>
|
||||
<key>selection</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
<!--
|
||||
Explicitly set the gutter color since bat falls back to a
|
||||
hardcoded DEFAULT_GUTTER_COLOR otherwise.
|
||||
-->
|
||||
<key>gutter</key>
|
||||
<string>#00000000</string>
|
||||
<string>#00000001</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Text</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
|
@ -58,39 +43,6 @@
|
|||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Delimiters</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Operators</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keywords</string>
|
||||
|
@ -102,17 +54,6 @@
|
|||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variables</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Functions</string>
|
||||
|
@ -146,17 +87,6 @@
|
|||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>meta.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Methods</string>
|
||||
|
@ -480,8 +410,6 @@
|
|||
<dict>
|
||||
<key>background</key>
|
||||
<string>#01000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
|
@ -493,8 +421,6 @@
|
|||
<dict>
|
||||
<key>background</key>
|
||||
<string>#03000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
2
assets/themes/gruvbox
vendored
2
assets/themes/gruvbox
vendored
|
@ -1 +1 @@
|
|||
Subproject commit e3db74d0e5de7bc09cab76377723ccf6bcc64e8c
|
||||
Subproject commit 64c47250e54298b91e2cf8d401320009aba9f991
|
10
diagnostics/info.sh
vendored
10
diagnostics/info.sh
vendored
|
@ -58,7 +58,8 @@ _bat_:run() {
|
|||
_out "$BAT" --version
|
||||
_out env | grep '^BAT_\|^PAGER='
|
||||
|
||||
local cache_dir="$($BAT --cache-dir)"
|
||||
local cache_dir
|
||||
cache_dir="$($BAT --cache-dir)"
|
||||
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
||||
_print_command "$BAT" "--list-languages"
|
||||
echo "Found custom syntax set."
|
||||
|
@ -79,8 +80,8 @@ _bat_config_:run() {
|
|||
_bat_wrapper_:run() {
|
||||
_bat_wrapper_:detect_wrapper() {
|
||||
local bat="$1"
|
||||
if file "$(which "${bat}")" | grep "text executable" &> /dev/null; then
|
||||
_out_fence cat "$(which "${bat}")"
|
||||
if file "$(command -v "${bat}")" | grep "text executable" &> /dev/null; then
|
||||
_out_fence cat "$(command -v "${bat}")"
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -104,7 +105,8 @@ _bat_wrapper_function_:run() {
|
|||
fi ;;
|
||||
|
||||
*bash* | *zsh*)
|
||||
local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||
local type
|
||||
type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||
if grep 'function' <<< "$type" &> /dev/null; then
|
||||
_out_fence "$SHELL" --login -i -c "declare -f ${command}"
|
||||
return
|
||||
|
|
|
@ -11,6 +11,7 @@ use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
|||
use path_abs::PathAbs;
|
||||
|
||||
use crate::assets_metadata::AssetsMetadata;
|
||||
use crate::bat_warning;
|
||||
use crate::error::*;
|
||||
use crate::input::{InputReader, OpenedInput, OpenedInputKind};
|
||||
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||
|
@ -189,13 +190,12 @@ impl HighlightingAssets {
|
|||
match self.theme_set.themes.get(theme) {
|
||||
Some(theme) => theme,
|
||||
None => {
|
||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
||||
return self.get_theme("ansi");
|
||||
}
|
||||
if theme != "" {
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!(
|
||||
"{}: Unknown theme '{}', using default.",
|
||||
Yellow.paint("[bat warning]"),
|
||||
theme
|
||||
);
|
||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||
}
|
||||
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use console::Term;
|
|||
use crate::input::{new_file_input, new_stdin_input};
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
bat_warning,
|
||||
config::{Config, VisibleLines},
|
||||
error::*,
|
||||
input::Input,
|
||||
|
@ -82,10 +83,9 @@ impl App {
|
|||
Some("always") => PagingMode::Always,
|
||||
Some("never") => PagingMode::Never,
|
||||
Some("auto") | None => {
|
||||
if self.matches.occurrences_of("plain") > 1 {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
PagingMode::Never
|
||||
} else if self.matches.is_present("no-paging") {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
let extra_plain = self.matches.occurrences_of("plain") > 1;
|
||||
if extra_plain || self.matches.is_present("no-paging") {
|
||||
PagingMode::Never
|
||||
} else if inputs.iter().any(Input::is_stdin) {
|
||||
// If we are reading from stdin, only enable paging if we write to an
|
||||
|
@ -323,11 +323,7 @@ impl App {
|
|||
|
||||
// If `grid` is set, remove `rule` as it is a subset of `grid`, and print a warning.
|
||||
if styled_components.grid() && styled_components.0.remove(&StyleComponent::Rule) {
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!(
|
||||
"{}: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.",
|
||||
Yellow.paint("[bat warning]"),
|
||||
);
|
||||
bat_warning!("Style 'rule' is a subset of style 'grid', 'rule' will not be visible.");
|
||||
}
|
||||
|
||||
Ok(styled_components)
|
||||
|
|
|
@ -36,6 +36,7 @@ use bat::{
|
|||
input::Input,
|
||||
style::{StyleComponent, StyleComponents},
|
||||
MappingTarget,
|
||||
PagingMode,
|
||||
};
|
||||
|
||||
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
|
||||
|
@ -78,7 +79,9 @@ fn get_syntax_mapping_to_paths<'a>(
|
|||
map
|
||||
}
|
||||
|
||||
pub fn list_languages(config: &Config) -> Result<()> {
|
||||
pub fn get_languages(config: &Config) -> Result<String> {
|
||||
let mut result: String = String::new();
|
||||
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let mut languages = assets
|
||||
.syntaxes()
|
||||
|
@ -119,12 +122,9 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
if config.loop_through {
|
||||
for lang in languages {
|
||||
writeln!(stdout, "{}:{}", lang.name, lang.file_extensions.join(","))?;
|
||||
result += &format!("{}:{}\n", lang.name, lang.file_extensions.join(","));
|
||||
}
|
||||
} else {
|
||||
let longest = languages
|
||||
|
@ -145,7 +145,7 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
|||
};
|
||||
|
||||
for lang in languages {
|
||||
write!(stdout, "{:width$}{}", lang.name, separator, width = longest)?;
|
||||
result += &format!("{:width$}{}", lang.name, separator, width = longest);
|
||||
|
||||
// Number of characters on this line so far, wrap before `desired_width`
|
||||
let mut num_chars = 0;
|
||||
|
@ -156,20 +156,20 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
|||
let new_chars = word.len() + comma_separator.len();
|
||||
if num_chars + new_chars >= desired_width {
|
||||
num_chars = 0;
|
||||
write!(stdout, "\n{:width$}{}", "", separator, width = longest)?;
|
||||
result += &format!("\n{:width$}{}", "", separator, width = longest);
|
||||
}
|
||||
|
||||
num_chars += new_chars;
|
||||
write!(stdout, "{}", style.paint(&word[..]))?;
|
||||
result += &format!("{}", style.paint(&word[..]));
|
||||
if extension.peek().is_some() {
|
||||
write!(stdout, "{}", comma_separator)?;
|
||||
result += comma_separator;
|
||||
}
|
||||
}
|
||||
writeln!(stdout)?;
|
||||
result += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn theme_preview_file<'a>() -> Input<'a> {
|
||||
|
@ -200,19 +200,19 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
|||
.ok();
|
||||
writeln!(stdout)?;
|
||||
}
|
||||
writeln!(
|
||||
stdout,
|
||||
"Further themes can be installed to '{}', \
|
||||
and are added to the cache with `bat cache --build`. \
|
||||
For more information, see:\n\n \
|
||||
https://github.com/sharkdp/bat#adding-new-themes",
|
||||
config_file().join("themes").to_string_lossy()
|
||||
)?;
|
||||
} else {
|
||||
for theme in assets.themes() {
|
||||
writeln!(stdout, "{}", theme)?;
|
||||
}
|
||||
}
|
||||
writeln!(
|
||||
stdout,
|
||||
"Further themes can be installed to '{}', \
|
||||
and are added to the cache with `bat cache --build`. \
|
||||
For more information, see:\n\n \
|
||||
https://github.com/sharkdp/bat#adding-new-themes",
|
||||
config_file().join("themes").to_string_lossy()
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -248,8 +248,14 @@ fn run() -> Result<bool> {
|
|||
let config = app.config(&inputs)?;
|
||||
|
||||
if app.matches.is_present("list-languages") {
|
||||
list_languages(&config)?;
|
||||
Ok(true)
|
||||
let languages: String = get_languages(&config)?;
|
||||
let inputs: Vec<Input> = vec![Input::from_reader(Box::new(languages.as_bytes()))];
|
||||
let plain_config = Config {
|
||||
style_components: StyleComponents::new(StyleComponent::Plain.components(false)),
|
||||
paging_mode: PagingMode::QuitIfOneScreen,
|
||||
..Default::default()
|
||||
};
|
||||
run_controller(inputs, &plain_config)
|
||||
} else if app.matches.is_present("list-themes") {
|
||||
list_themes(&config)?;
|
||||
Ok(true)
|
||||
|
|
|
@ -197,6 +197,8 @@ impl<'b> Controller<'b> {
|
|||
let mut first_range: bool = true;
|
||||
let mut mid_range: bool = false;
|
||||
|
||||
let style_snip = self.config.style_components.snip();
|
||||
|
||||
while reader.read_line(&mut line_buffer)? {
|
||||
match line_ranges.check(line_number) {
|
||||
RangeCheckResult::BeforeOrBetweenRanges => {
|
||||
|
@ -207,7 +209,7 @@ impl<'b> Controller<'b> {
|
|||
}
|
||||
|
||||
RangeCheckResult::InRange => {
|
||||
if self.config.style_components.snip() {
|
||||
if style_snip {
|
||||
if first_range {
|
||||
first_range = false;
|
||||
mid_range = true;
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
//! .unwrap();
|
||||
//! ```
|
||||
|
||||
mod macros;
|
||||
|
||||
pub mod assets;
|
||||
pub mod assets_metadata;
|
||||
pub mod config;
|
||||
|
|
7
src/macros.rs
Normal file
7
src/macros.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
#[macro_export]
|
||||
macro_rules! bat_warning {
|
||||
($($arg:tt)*) => ({
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!("{}: {}", Yellow.paint("[bat warning]"), format!($($arg)*));
|
||||
})
|
||||
}
|
|
@ -72,7 +72,7 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
|||
}
|
||||
}
|
||||
// line feed
|
||||
'\x0A' => output.push('␊'),
|
||||
'\x0A' => output.push_str("␊\x0A"),
|
||||
// carriage return
|
||||
'\x0D' => output.push('␍'),
|
||||
// null
|
||||
|
|
|
@ -91,9 +91,6 @@ impl<'a> Printer for SimplePrinter<'a> {
|
|||
if self.config.show_nonprintable {
|
||||
let line = replace_nonprintable(line_buffer, self.config.tab_width);
|
||||
write!(handle, "{}", line)?;
|
||||
if line_buffer.last() == Some(&b'\n') {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
} else {
|
||||
handle.write_all(line_buffer)?
|
||||
};
|
||||
|
@ -451,7 +448,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||
if text.len() != text_trimmed.len() {
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background = Some(to_ansi_color(background_color, true_color));
|
||||
ansi_style.background = to_ansi_color(background_color, true_color);
|
||||
let width = if cursor_total <= cursor_max {
|
||||
cursor_max - cursor_total + 1
|
||||
} else {
|
||||
|
@ -463,7 +460,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
if line.bytes().next_back() != Some(b'\n') {
|
||||
if !self.config.style_components.plain() && line.bytes().next_back() != Some(b'\n') {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
} else {
|
||||
|
@ -592,8 +589,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background =
|
||||
Some(to_ansi_color(background_color, self.config.true_color));
|
||||
ansi_style.background = to_ansi_color(background_color, self.config.true_color);
|
||||
|
||||
write!(
|
||||
handle,
|
||||
|
@ -627,20 +623,27 @@ impl Colors {
|
|||
}
|
||||
|
||||
fn colored(theme: &Theme, true_color: bool) -> Self {
|
||||
let gutter_color = theme
|
||||
.settings
|
||||
.gutter_foreground
|
||||
.map(|c| to_ansi_color(c, true_color))
|
||||
.unwrap_or(Fixed(DEFAULT_GUTTER_COLOR));
|
||||
let gutter_style = Style {
|
||||
foreground: match theme.settings.gutter_foreground {
|
||||
// If the theme provides a gutter foreground color, use it.
|
||||
// Note: It might be the special value #00000001, in which case
|
||||
// to_ansi_color returns None and we use an empty Style
|
||||
// (resulting in the terminal's default foreground color).
|
||||
Some(c) => to_ansi_color(c, true_color),
|
||||
// Otherwise, use a specific fallback color.
|
||||
None => Some(Fixed(DEFAULT_GUTTER_COLOR)),
|
||||
},
|
||||
..Style::default()
|
||||
};
|
||||
|
||||
Colors {
|
||||
grid: gutter_color.normal(),
|
||||
rule: gutter_color.normal(),
|
||||
grid: gutter_style,
|
||||
rule: gutter_style,
|
||||
filename: Style::new().bold(),
|
||||
git_added: Green.normal(),
|
||||
git_removed: Red.normal(),
|
||||
git_modified: Yellow.normal(),
|
||||
line_number: gutter_color.normal(),
|
||||
line_number: gutter_style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ use ansi_term::{self, Style};
|
|||
|
||||
use syntect::highlighting::{self, FontStyle};
|
||||
|
||||
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Color {
|
||||
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ansi_term::Color> {
|
||||
if color.a == 0 {
|
||||
// Themes can specify one of the user-configurable terminal colors by
|
||||
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
|
||||
// to the 8-bit color palette number. The built-in themes ansi-light,
|
||||
// ansi-dark, base16, and base16-256 use this.
|
||||
match color.r {
|
||||
// to the 8-bit color palette number. The built-in themes ansi, base16,
|
||||
// and base16-256 use this.
|
||||
Some(match color.r {
|
||||
// For the first 8 colors, use the Color enum to produce ANSI escape
|
||||
// sequences using codes 30-37 (foreground) and 40-47 (background).
|
||||
// For example, red foreground is \x1b[31m. This works on terminals
|
||||
|
@ -31,11 +31,18 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term:
|
|||
// 90-97 (foreground) and 100-107 (background), we should use those
|
||||
// for values 0x08 to 0x0f and only use Fixed for 0x10 to 0xff.
|
||||
n => Fixed(n),
|
||||
}
|
||||
})
|
||||
} else if color.a == 1 {
|
||||
// Themes can specify the terminal's default foreground/background color
|
||||
// (i.e. no escape sequence) using the encoding #RRGGBBAA with AA set to
|
||||
// 01. The built-in theme ansi uses this.
|
||||
None
|
||||
} else if true_color {
|
||||
RGB(color.r, color.g, color.b)
|
||||
Some(RGB(color.r, color.g, color.b))
|
||||
} else {
|
||||
Fixed(ansi_colours::ansi256_from_rgb((color.r, color.g, color.b)))
|
||||
Some(Fixed(ansi_colours::ansi256_from_rgb((
|
||||
color.r, color.g, color.b,
|
||||
))))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +61,10 @@ pub fn as_terminal_escaped(
|
|||
let mut style = if !colored {
|
||||
Style::default()
|
||||
} else {
|
||||
let mut color = Style::from(to_ansi_color(style.foreground, true_color));
|
||||
let mut color = Style {
|
||||
foreground: to_ansi_color(style.foreground, true_color),
|
||||
..Style::default()
|
||||
};
|
||||
if style.font_style.contains(FontStyle::BOLD) {
|
||||
color = color.bold();
|
||||
}
|
||||
|
@ -67,6 +77,6 @@ pub fn as_terminal_escaped(
|
|||
color
|
||||
};
|
||||
|
||||
style.background = background_color.map(|c| to_ansi_color(c, true_color));
|
||||
style.background = background_color.and_then(|c| to_ansi_color(c, true_color));
|
||||
style.paint(text).to_string()
|
||||
}
|
||||
|
|
|
@ -30,13 +30,11 @@ fn all_themes_are_present() {
|
|||
"Solarized (light)",
|
||||
"Sublime Snazzy",
|
||||
"TwoDark",
|
||||
"ansi-dark",
|
||||
"ansi-light",
|
||||
"ansi",
|
||||
"base16",
|
||||
"base16-256",
|
||||
"gruvbox",
|
||||
"gruvbox-dark",
|
||||
"gruvbox-light",
|
||||
"gruvbox-white",
|
||||
"zenburn"
|
||||
]
|
||||
);
|
||||
|
|
4
tests/benchmarks/comparison.sh
vendored
4
tests/benchmarks/comparison.sh
vendored
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
if ! which hyperfine > /dev/null 2>&1; then
|
||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
|
|
4
tests/benchmarks/run-benchmarks.sh
vendored
4
tests/benchmarks/run-benchmarks.sh
vendored
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
if ! which hyperfine > /dev/null 2>&1; then
|
||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
|
|
|
@ -837,3 +837,41 @@ fn show_all_mode() {
|
|||
.stdout("hello·world␊\n├──┤␍␀␇␈␛")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plain_mode_does_not_add_nonexisting_newline() {
|
||||
bat()
|
||||
.arg("--paging=never")
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=plain")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/sharkdp/bat/issues/299
|
||||
#[test]
|
||||
fn grid_for_file_without_newline() {
|
||||
bat()
|
||||
.arg("--paging=never")
|
||||
.arg("--color=never")
|
||||
.arg("--terminal-width=80")
|
||||
.arg("--wrap=never")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=full")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"\
|
||||
───────┬────────────────────────────────────────────────────────────────────────
|
||||
│ File: single-line.txt
|
||||
───────┼────────────────────────────────────────────────────────────────────────
|
||||
1 │ Single Line
|
||||
───────┴────────────────────────────────────────────────────────────────────────
|
||||
",
|
||||
)
|
||||
.stderr("");
|
||||
}
|
||||
|
|
|
@ -175,4 +175,4 @@
|
|||
[38;2;117;113;94m\u{ad}[0m[38;2;249;38;114m␊[0m
|
||||
[38;2;117;113;94m\u{ae}[0m[38;2;249;38;114m␊[0m
|
||||
[38;2;249;38;114m␊[0m
|
||||
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m
|
||||
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m[38;2;249;38;114m␊[0m
|
||||
|
|
92
tests/syntax-tests/highlighted/VimL/source.vim
Normal file
92
tests/syntax-tests/highlighted/VimL/source.vim
Normal file
|
@ -0,0 +1,92 @@
|
|||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m&compatible[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mset[0m[38;2;248;248;242m nocompatible[0m
|
||||
[38;2;249;38;114mendif[0m
|
||||
|
||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;102;217;239mhas[0m[38;2;248;248;242m([0m[38;2;230;219;116m'win32'[0m[38;2;248;248;242m) [0m[38;2;249;38;114m||[0m[38;2;248;248;242m has ([0m[38;2;230;219;116m'win64'[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m $VIMHOME = $HOME [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/vimfiles"[0m
|
||||
[38;2;249;38;114melseif[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:false[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:true[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Can't get here"[0m
|
||||
[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m $VIMHOME = $HOME [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/.vim"[0m
|
||||
[38;2;249;38;114mendif[0m
|
||||
|
||||
[38;2;117;113;94m" show existing tab with 2 spaces width[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m tabstop=[0m[38;2;190;132;255m2[0m
|
||||
[38;2;117;113;94m" when indenting with '>', use 2 spaces width[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m shiftwidth=[0m[38;2;190;132;255m2[0m
|
||||
[38;2;117;113;94m" always set autoindenting on[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m autoindent[0m
|
||||
|
||||
[38;2;102;217;239mautocmd[0m[38;2;248;248;242m VimEnter [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello Vim"[0m
|
||||
|
||||
[38;2;117;113;94m" Allow :W and :Wq to save too[0m
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! Wq :wq[0m
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! W :w[0m
|
||||
|
||||
[38;2;249;38;114maugroup[0m[38;2;248;248;242m vimrc[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mautocmd[0m[38;2;248;248;242m![0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mautocmd[0m[38;2;248;248;242m [0m[38;2;248;248;242mFileType[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"New filetype"[0m
|
||||
[38;2;249;38;114maugroup[0m[38;2;248;248;242m END[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46ms:echo[0m[38;2;248;248;242m([0m[38;2;248;248;242mwhat)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;248;248;242mwhat[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46mHelloWorld[0m[38;2;248;248;242m([0m[38;2;248;248;242mname)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:function_local[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"function_local_var"[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:parts[0m[38;2;248;248;242m = [0m[38;2;102;217;239msplit[0m[38;2;248;248;242m([0m[38;2;255;255;255ml:function_local[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"_"[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ml:greeting[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"Hello "[0m[38;2;248;248;242m [0m[38;2;249;38;114m.[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;248;248;242mname[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;102;217;239ms:echo[0m[38;2;248;248;242m([0m[38;2;255;255;255ml:greeting[0m[38;2;248;248;242m)[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46msource#Hello[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello from namespace"[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;249;38;114mfunction[0m[38;2;248;248;242m! [0m[38;2;166;226;46mEchoFunc[0m[38;2;248;248;242m([0m[38;2;249;38;114m.[0m[38;2;249;38;114m.[0m[38;2;249;38;114m.[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m s [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;102;217;239ma[0m[38;2;249;38;114m:[0m[38;2;190;132;255m000[0m
|
||||
[38;2;248;248;242m echon [0m[38;2;230;219;116m' '[0m[38;2;248;248;242m [0m[38;2;249;38;114m.[0m[38;2;248;248;242m s[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfor[0m
|
||||
[38;2;249;38;114mendfunction[0m
|
||||
|
||||
[38;2;102;217;239mimap[0m[38;2;248;248;242m [0m[3;38;2;166;226;46m<C-h>[0m[38;2;248;248;242m [0m[3;38;2;166;226;46m<C-r>[0m[38;2;248;248;242m=[0m[38;2;102;217;239mHelloWorld[0m[38;2;248;248;242m([0m[38;2;230;219;116m"World"[0m[38;2;248;248;242m)[0m[3;38;2;166;226;46m<CR>[0m
|
||||
|
||||
[38;2;102;217;239mcommand[0m[38;2;248;248;242m! [0m[3;38;2;166;226;46m-nargs=[0m[38;2;248;248;242m? Echo :call [0m[38;2;102;217;239mEchoFunc[0m[38;2;248;248;242m([0m[3;38;2;166;226;46m<args>[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;117;113;94m" TODO test stuff[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:global[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"global var"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255ms:script_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"script var"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mw:window_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"window war"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mb:buffer_var[0m[38;2;248;248;242m = [0m[38;2;230;219;116m"buffer war"[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m t[0m[38;2;249;38;114m:[0m[38;2;248;248;242mtab_var = [0m[38;2;230;219;116m"tab war"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;255;255;255mv:false[0m
|
||||
|
||||
[38;2;190;132;255m3[0m[38;2;248;248;242m + [0m[38;2;190;132;255m5[0m
|
||||
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==#[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==?[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m is [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114misnot[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m=~[0m[38;2;248;248;242m [0m[38;2;230;219;116m'xx*'[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m!~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello"[0m[38;2;248;248;242m [0m[38;2;249;38;114m!~[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Hello2"[0m
|
||||
|
||||
[38;2;102;217;239mecho[0m[38;2;248;248;242m [0m[38;2;230;219;116m"/This/should/not/be/a/regex"[0m
|
||||
|
||||
[38;2;117;113;94m" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)[0m
|
||||
[38;2;102;217;239mset[0m[38;2;248;248;242m runtimepath[0m[38;2;249;38;114m=~[0m[38;2;248;248;242m/foo/bar[0m
|
||||
|
||||
[38;2;248;248;242msilent [0m[38;2;246;170;17mg/Aap/[0m[38;2;248;248;242mp[0m
|
||||
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;248;248;242m = {}[0m
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict[0m[38;2;249;38;114m.[0m[38;2;248;248;242mitem = [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m][0m
|
||||
|
||||
[38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mg:dict2[0m[38;2;248;248;242m = {[0m[38;2;230;219;116m'dict_item'[0m[38;2;248;248;242m: [[0m[38;2;230;219;116m'l1'[0m[38;2;248;248;242m, [0m[38;2;230;219;116m'l2'[0m[38;2;248;248;242m], [0m[38;2;230;219;116m'di2'[0m[38;2;248;248;242m: [0m[38;2;230;219;116m'x'[0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242msilent [0m[38;2;246;170;17mg/regex/[0m
|
||||
[38;2;248;248;242msilent [0m[38;2;246;170;17mv/regex/[0m
|
||||
[38;2;248;248;242msilent [0m[38;2;249;38;114m%[0m[38;2;246;170;17ms/regex/[0m[38;2;248;248;242mnot_regex/[0m
|
||||
|
||||
[38;2;102;217;239mfiletype[0m[38;2;248;248;242m plugin indent on[0m
|
||||
[38;2;102;217;239msyntax[0m[38;2;248;248;242m enable[0m
|
2
tests/syntax-tests/regression_test.sh
vendored
2
tests/syntax-tests/regression_test.sh
vendored
|
@ -4,7 +4,7 @@ set -eou pipefail
|
|||
|
||||
script_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
output_directory=$(mktemp -d --suffix=.bat-syntax-regression-test)
|
||||
output_directory=$(mktemp -d)
|
||||
|
||||
"$script_directory"/create_highlighted_versions.py --output="$output_directory"
|
||||
|
||||
|
|
|
@ -72,4 +72,4 @@ package TestSyntax {
|
|||
var sndChannel:SoundChannel = mySound.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,4 @@ set LDLIBS= ^
|
|||
@set "LINK_FILES=%LINK_FILES% %%~f"
|
||||
)
|
||||
|
||||
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
|
||||
lld-link.exe %LINK_FILES% -out:"%OUTPUT%" %LDFLAGS% %LDLIBS%
|
||||
|
|
|
@ -55,4 +55,4 @@
|
|||
(println (factorial 5))
|
||||
(log)
|
||||
(log "Message"))
|
||||
|
||||
|
||||
|
|
|
@ -16,4 +16,4 @@ EXPOSE 80/tcp
|
|||
|
||||
VOLUME [/var/lib/mysql/data]
|
||||
|
||||
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
||||
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
||||
|
|
|
@ -13,4 +13,4 @@
|
|||
*.patch -text
|
||||
|
||||
.gitattributes linguist-language=gitattributes
|
||||
.gitkeep export-ignore
|
||||
.gitkeep export-ignore
|
||||
|
|
|
@ -104,4 +104,4 @@
|
|||
[user]
|
||||
email = f.nord@example.com
|
||||
name = Frank Nord
|
||||
signingkey = AAAAAAAAAAAAAAAA
|
||||
signingkey = AAAAAAAAAAAAAAAA
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
192.160.0.200 try.sample.test try #another comment
|
||||
216.58.223.238 google.com
|
||||
|
||||
::1 localhost.try ip6-localhost
|
||||
::1 localhost.try ip6-localhost
|
||||
|
|
|
@ -382,4 +382,4 @@ install: all
|
|||
@ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME)
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}
|
||||
rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)}
|
||||
|
|
|
@ -108,4 +108,4 @@ $doe->setName('John Doe');
|
|||
|
||||
$ending = 2 > 3 ? "yep" : "nah";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -5,4 +5,4 @@ pywheels>=12.4 #a whitespace followed by comments
|
|||
Nuitka<0.6.8.4
|
||||
wxPython>=1.0, <=2.1
|
||||
|
||||
#this is another comment
|
||||
#this is another comment
|
||||
|
|
92
tests/syntax-tests/source/VimL/source.vim
Normal file
92
tests/syntax-tests/source/VimL/source.vim
Normal file
|
@ -0,0 +1,92 @@
|
|||
if &compatible
|
||||
set nocompatible
|
||||
endif
|
||||
|
||||
if has('win32') || has ('win64')
|
||||
let $VIMHOME = $HOME . "/vimfiles"
|
||||
elseif v:false && v:true
|
||||
echo "Can't get here"
|
||||
else
|
||||
let $VIMHOME = $HOME . "/.vim"
|
||||
endif
|
||||
|
||||
" show existing tab with 2 spaces width
|
||||
set tabstop=2
|
||||
" when indenting with '>', use 2 spaces width
|
||||
set shiftwidth=2
|
||||
" always set autoindenting on
|
||||
set autoindent
|
||||
|
||||
autocmd VimEnter * echo "Hello Vim"
|
||||
|
||||
" Allow :W and :Wq to save too
|
||||
command! Wq :wq
|
||||
command! W :w
|
||||
|
||||
augroup vimrc
|
||||
autocmd!
|
||||
autocmd FileType * echo "New filetype"
|
||||
augroup END
|
||||
|
||||
function! s:echo(what)
|
||||
return a:what
|
||||
endfunction
|
||||
|
||||
function! HelloWorld(name)
|
||||
let l:function_local = "function_local_var"
|
||||
let l:parts = split(l:function_local, "_")
|
||||
let l:greeting = "Hello " . a:name
|
||||
return s:echo(l:greeting)
|
||||
endfunction
|
||||
|
||||
function! source#Hello()
|
||||
return "Hello from namespace"
|
||||
endfunction
|
||||
|
||||
function! EchoFunc(...)
|
||||
for s in a:000
|
||||
echon ' ' . s
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
imap <C-h> <C-r>=HelloWorld("World")<CR>
|
||||
|
||||
command! -nargs=? Echo :call EchoFunc(<args>)
|
||||
|
||||
" TODO test stuff
|
||||
let g:global = "global var"
|
||||
let s:script_var = "script var"
|
||||
let w:window_var = "window war"
|
||||
let b:buffer_var = "buffer war"
|
||||
let t:tab_var = "tab war"
|
||||
echo v:false
|
||||
|
||||
3 + 5
|
||||
|
||||
echo "Hello" ==# "Hello2"
|
||||
echo "Hello" ==? "Hello2"
|
||||
echo "Hello" == "Hello2"
|
||||
echo "Hello" is "Hello2"
|
||||
echo "Hello" isnot "Hello2"
|
||||
echo "Hello" =~ 'xx*'
|
||||
echo "Hello" !~ "Hello2"
|
||||
echo "Hello" !~ "Hello2"
|
||||
|
||||
echo "/This/should/not/be/a/regex"
|
||||
|
||||
" Error case from issue #1604 (https://github.com/sharkdp/bat/issues/1064)
|
||||
set runtimepath=~/foo/bar
|
||||
|
||||
silent g/Aap/p
|
||||
|
||||
let g:dict = {}
|
||||
let g:dict.item = ['l1', 'l2']
|
||||
|
||||
let g:dict2 = {'dict_item': ['l1', 'l2'], 'di2': 'x'}
|
||||
|
||||
silent g/regex/
|
||||
silent v/regex/
|
||||
silent %s/regex/not_regex/
|
||||
|
||||
filetype plugin indent on
|
||||
syntax enable
|
|
@ -31,4 +31,4 @@ emails:
|
|||
- bob@example.com
|
||||
- bill@example.com
|
||||
supervisors:
|
||||
- george@example.com
|
||||
- george@example.com
|
||||
|
|
|
@ -317,4 +317,4 @@ blank lines before and after.)
|
|||
..
|
||||
|
||||
So this block is not "lost",
|
||||
despite its indentation.
|
||||
despite its indentation.
|
||||
|
|
2
tests/syntax-tests/update.sh
vendored
2
tests/syntax-tests/update.sh
vendored
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
python="python3"
|
||||
if ! command -v python3 &>/dev/null; then python="python"; fi
|
||||
|
|
Loading…
Reference in a new issue