mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 19:02:22 +01:00
Compare commits
5 Commits
dependabot
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
15178bca3f | ||
|
05ccdcd27b | ||
|
f76f905771 | ||
|
c963e80343 | ||
|
ea1fbacf76 |
@@ -1,2 +0,0 @@
|
||||
[advisories]
|
||||
ignore = ["RUSTSEC-2024-0320", "RUSTSEC-2024-0421"]
|
2
.github/ISSUE_TEMPLATE/syntax_request.md
vendored
2
.github/ISSUE_TEMPLATE/syntax_request.md
vendored
@@ -26,4 +26,4 @@ guidelines for adding new syntaxes:
|
||||
[Name or description of the syntax/language here]
|
||||
|
||||
**Guideline Criteria:**
|
||||
[packagecontrol.io link here]
|
||||
[packagecontro.io link here]
|
||||
|
23
.github/workflows/Auto-merge-dependabot-PRs.yml
vendored
Normal file
23
.github/workflows/Auto-merge-dependabot-PRs.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# This workflow triggers auto-merge of any PR that dependabot creates so that
|
||||
# PRs will be merged automatically without maintainer intervention if CI passes
|
||||
name: Auto-merge dependabot PRs
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
auto-merge:
|
||||
if: github.repository == 'sharkdp/bat' && startsWith(github.head_ref, 'dependabot/')
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: auto-merge
|
||||
url: https://github.com/sharkdp/bat/blob/main/.github/workflows/Auto-merge-dependabot-PRs.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.AUTO_MERGE_GITHUB_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: |
|
||||
gh pr review ${{ github.event.pull_request.number }} --comment --body "If CI passes, this dependabot PR will be [auto-merged](https://github.com/sharkdp/bat/blob/main/.github/workflows/Auto-merge-dependabot-PRs.yml) 🚀"
|
||||
- run: |
|
||||
gh pr merge --auto --squash ${{ github.event.pull_request.number }}
|
72
.github/workflows/CICD.yml
vendored
72
.github/workflows/CICD.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- crate_metadata
|
||||
- lint
|
||||
- ensure_cargo_fmt
|
||||
- min_version
|
||||
- license_checks
|
||||
- test_with_new_syntaxes_and_themes
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
name: Extract crate metadata
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- name: Extract crate information
|
||||
id: crate_metadata
|
||||
run: |
|
||||
@@ -51,46 +51,49 @@ jobs:
|
||||
homepage: ${{ steps.crate_metadata.outputs.homepage }}
|
||||
msrv: ${{ steps.crate_metadata.outputs.msrv }}
|
||||
|
||||
lint:
|
||||
name: Ensure code quality
|
||||
runs-on: ubuntu-latest
|
||||
ensure_cargo_fmt:
|
||||
name: Ensure 'cargo fmt' has been run
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt,clippy
|
||||
- uses: actions/checkout@v5
|
||||
components: rustfmt
|
||||
- uses: actions/checkout@v4
|
||||
- run: cargo fmt -- --check
|
||||
- run: cargo clippy --locked --all-targets --all-features -- -D warnings
|
||||
|
||||
min_version:
|
||||
name: Minimum supported rust version
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
needs: crate_metadata
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }})
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ needs.crate_metadata.outputs.msrv }}
|
||||
components: clippy
|
||||
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
||||
run: cargo clippy --locked --all-targets ${{ env.MSRV_FEATURES }}
|
||||
- name: Run tests
|
||||
run: cargo test --locked ${{ env.MSRV_FEATURES }}
|
||||
|
||||
license_checks:
|
||||
name: License checks
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true # we especially want to perform license checks on submodules
|
||||
- run: tests/scripts/license-checks.sh
|
||||
|
||||
test_with_new_syntaxes_and_themes:
|
||||
name: Run tests with updated syntaxes and themes
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true # we need all syntax and theme submodules
|
||||
- name: Install Rust toolchain
|
||||
@@ -116,10 +119,10 @@ jobs:
|
||||
|
||||
test_with_system_config:
|
||||
name: Run tests with system wide configuration
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
- name: Prepare environment variables
|
||||
run: |
|
||||
echo "BAT_SYSTEM_CONFIG_PREFIX=$GITHUB_WORKSPACE/tests/examples/system_config" >> $GITHUB_ENV
|
||||
@@ -132,10 +135,10 @@ jobs:
|
||||
|
||||
documentation:
|
||||
name: Documentation
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
- name: Check documentation
|
||||
@@ -149,8 +152,7 @@ jobs:
|
||||
name: cargo audit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: cargo install cargo-audit --locked
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- run: cargo audit
|
||||
|
||||
build:
|
||||
@@ -161,24 +163,22 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job:
|
||||
- { target: aarch64-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: arm64, use-cross: true }
|
||||
- { target: aarch64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: arm64, use-cross: true }
|
||||
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-latest, dpkg_arch: armhf, use-cross: true }
|
||||
- { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, dpkg_arch: musl-linux-armhf, use-cross: true }
|
||||
- { target: i686-pc-windows-msvc , os: windows-2025, }
|
||||
- { target: i686-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: i686, use-cross: true }
|
||||
- { target: i686-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-i686, use-cross: true }
|
||||
- { target: x86_64-apple-darwin , os: macos-13, }
|
||||
- { target: aarch64-apple-darwin , os: macos-14, }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2025, }
|
||||
- { target: aarch64-pc-windows-msvc , os: windows-11-arm, }
|
||||
- { target: x86_64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: amd64, use-cross: true }
|
||||
- { target: x86_64-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-amd64, use-cross: true }
|
||||
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, dpkg_arch: arm64, use-cross: true }
|
||||
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, dpkg_arch: armhf, use-cross: true }
|
||||
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, dpkg_arch: musl-linux-armhf, use-cross: true }
|
||||
- { target: i686-pc-windows-msvc , os: windows-2019, }
|
||||
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, dpkg_arch: i686, use-cross: true }
|
||||
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, dpkg_arch: musl-linux-i686, use-cross: true }
|
||||
- { target: x86_64-apple-darwin , os: macos-12, }
|
||||
- { target: x86_64-pc-windows-gnu , os: windows-2019, }
|
||||
- { target: x86_64-pc-windows-msvc , os: windows-2019, }
|
||||
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, dpkg_arch: amd64, use-cross: true }
|
||||
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, dpkg_arch: musl-linux-amd64, use-cross: true }
|
||||
env:
|
||||
BUILD_CMD: cargo
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install prerequisites
|
||||
shell: bash
|
||||
@@ -444,7 +444,7 @@ jobs:
|
||||
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Publish archives and packages
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.is-release.outputs.IS_RELEASE
|
||||
with:
|
||||
files: |
|
||||
@@ -459,7 +459,7 @@ jobs:
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
|
||||
- uses: vedantmgoyal2009/winget-releaser@v2
|
||||
with:
|
||||
identifier: sharkdp.bat
|
||||
installers-regex: '-pc-windows-msvc\.zip$'
|
||||
|
14
.github/workflows/require-changelog-for-PRs.yml
vendored
14
.github/workflows/require-changelog-for-PRs.yml
vendored
@@ -29,5 +29,15 @@ jobs:
|
||||
ADDED=$(git diff -U0 "origin/${PR_BASE}" HEAD -- CHANGELOG.md | grep -P '^\+[^\+].+$')
|
||||
echo "Added lines in CHANGELOG.md:"
|
||||
echo "$ADDED"
|
||||
echo "Grepping for PR info (see CONTRIBUTING.md):"
|
||||
grep "#${PR_NUMBER}\\b.*${PR_SUBMITTER}\\b" <<< "$ADDED"
|
||||
|
||||
escape_regex_meta_chars() {
|
||||
# https://stackoverflow.com/a/16951928/4473405
|
||||
sed 's/[][\.|$(){}?+*^]/\\&/g' <<< "$*"
|
||||
}
|
||||
|
||||
double_escape_slash_for_bash() {
|
||||
sed 's/\\/\\\\/g' <<< "$*"
|
||||
}
|
||||
|
||||
echo "Grepping for PR info:"
|
||||
grep "#${PR_NUMBER}\\b.*[(]@$(quote ${PR_SUBMITTER})[)]" <<< "$ADDED"
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,7 +2,6 @@
|
||||
**/*.rs.bk
|
||||
|
||||
# Generated files
|
||||
/assets/completions/_bat.ps1
|
||||
/assets/completions/bat.bash
|
||||
/assets/completions/bat.fish
|
||||
/assets/completions/bat.zsh
|
||||
|
42
.gitmodules
vendored
42
.gitmodules
vendored
@@ -65,7 +65,7 @@
|
||||
path = assets/themes/onehalf
|
||||
url = https://github.com/sonph/onehalf
|
||||
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||
path = assets/syntaxes/02_Extra/JavaScript_(Babel)
|
||||
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
||||
url = https://github.com/babel/babel-sublime
|
||||
[submodule "assets/syntaxes/FSharp"]
|
||||
path = assets/syntaxes/02_Extra/FSharp
|
||||
@@ -89,7 +89,7 @@
|
||||
path = assets/themes/sublime-snazzy
|
||||
url = https://github.com/greggb/sublime-snazzy
|
||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||
path = assets/syntaxes/02_Extra/Assembly_(ARM)
|
||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
||||
path = assets/syntaxes/02_Extra/Protobuf
|
||||
@@ -108,11 +108,14 @@
|
||||
path = assets/syntaxes/02_Extra/Fish
|
||||
url = https://github.com/Phidica/sublime-fish.git
|
||||
[submodule "assets/syntaxes/Org mode"]
|
||||
path = assets/syntaxes/02_Extra/Org_mode
|
||||
path = assets/syntaxes/02_Extra/Org mode
|
||||
url = https://github.com/jezcope/Org.tmbundle.git
|
||||
[submodule "assets/syntaxes/DotENV"]
|
||||
path = assets/syntaxes/02_Extra/DotENV
|
||||
url = https://github.com/zaynali53/DotENV
|
||||
[submodule "assets/syntaxes/hosts"]
|
||||
path = assets/syntaxes/02_Extra/hosts
|
||||
url = https://github.com/brandonwamboldt/sublime-hosts
|
||||
[submodule "assets/syntaxes/ssh-config"]
|
||||
path = assets/syntaxes/02_Extra/ssh-config
|
||||
url = https://github.com/robballou/sublimetext-sshconfig.git
|
||||
@@ -139,7 +142,7 @@
|
||||
path = assets/themes/dracula-sublime
|
||||
url = https://github.com/dracula/sublime.git
|
||||
[submodule "assets/syntaxes/HTML (Twig)"]
|
||||
path = assets/syntaxes/02_Extra/HTML_(Twig)
|
||||
path = assets/syntaxes/02_Extra/HTML (Twig)
|
||||
url = https://github.com/Anomareh/PHP-Twig.tmbundle.git
|
||||
[submodule "assets/themes/Nord-sublime"]
|
||||
path = assets/themes/Nord-sublime
|
||||
@@ -174,7 +177,7 @@
|
||||
url = https://github.com/euler0/sublime-glsl
|
||||
[submodule "assets/syntaxes/02_Extra/Nginx"]
|
||||
path = assets/syntaxes/02_Extra/Nginx
|
||||
url = https://github.com/SublimeText/nginx
|
||||
url = https://github.com/brandonwamboldt/sublime-nginx
|
||||
[submodule "assets/syntaxes/02_Extra/Apache"]
|
||||
path = assets/syntaxes/02_Extra/Apache
|
||||
url = https://github.com/colinta/ApacheConf.tmLanguage
|
||||
@@ -193,7 +196,10 @@
|
||||
branch = bat-source
|
||||
[submodule "assets/syntaxes/02_Extra/Lean"]
|
||||
path = assets/syntaxes/02_Extra/Lean
|
||||
url = https://github.com/leanprover/vscode-lean4.git
|
||||
url = https://github.com/leanprover/vscode-lean.git
|
||||
[submodule "assets/syntaxes/02_Extra/LiveScript"]
|
||||
path = assets/syntaxes/02_Extra/LiveScript
|
||||
url = https://github.com/paulmillr/LiveScript.tmbundle
|
||||
[submodule "assets/syntaxes/02_Extra/Zig"]
|
||||
path = assets/syntaxes/02_Extra/Zig
|
||||
url = https://github.com/ziglang/sublime-zig-language.git
|
||||
@@ -254,27 +260,3 @@
|
||||
[submodule "assets/syntaxes/02_Extra/vscode-wgsl"]
|
||||
path = assets/syntaxes/02_Extra/vscode-wgsl
|
||||
url = https://github.com/PolyMeilex/vscode-wgsl.git
|
||||
[submodule "assets/syntaxes/02_Extra/CFML"]
|
||||
path = assets/syntaxes/02_Extra/CFML
|
||||
url = https://github.com/jcberquist/sublimetext-cfml.git
|
||||
[submodule "assets/syntaxes/02_Extra/Idris2"]
|
||||
path = assets/syntaxes/02_Extra/Idris2
|
||||
url = https://github.com/buzden/sublime-syntax-idris2
|
||||
[submodule "assets/syntaxes/02_Extra/GDScript-sublime"]
|
||||
path = assets/syntaxes/02_Extra/GDScript-sublime
|
||||
url = https://github.com/beefsack/GDScript-sublime
|
||||
[submodule "assets/syntaxes/02_Extra/sublime-odin"]
|
||||
path = assets/syntaxes/02_Extra/sublime-odin
|
||||
url = https://github.com/odin-lang/sublime-odin
|
||||
[submodule "assets/syntaxes/02_Extra/typst-syntax-highlight"]
|
||||
path = assets/syntaxes/02_Extra/typst-syntax-highlight
|
||||
url = https://github.com/hyrious/typst-syntax-highlight
|
||||
[submodule "assets/themes/Catppuccin"]
|
||||
path = assets/themes/Catppuccin
|
||||
url = https://github.com/SchweGELBin/catppuccin-bat-sub.git
|
||||
[submodule "assets/syntaxes/02_Extra/SmartVHDL"]
|
||||
path = assets/syntaxes/02_Extra/SmartVHDL
|
||||
url = https://github.com/TheClams/SmartVHDL
|
||||
[submodule "assets/syntaxes/02_Extra/hosts"]
|
||||
path = assets/syntaxes/02_Extra/hosts
|
||||
url = https://github.com/tijn/hosts.tmLanguage
|
||||
|
129
CHANGELOG.md
129
CHANGELOG.md
@@ -1,94 +1,10 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
- Add build for windows/ARM64 platform. #3190 (@alcroito)
|
||||
|
||||
- Add paging to `--list-themes`, see PR #3239 (@einfachIrgendwer0815)
|
||||
- Support negative relative line ranges, e.g. `bat -r :-10` / `bat -r='-10:'`, see #3068 (@ajesipow)
|
||||
- Support context in line ranges, e.g. `bat -r 30::5` / `bat -r 30:40:5`, see #3345 (@cavanaug)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix UTF-8 BOM not being stripped for syntax detection, see #3314 (@krikera)
|
||||
- Fix `BAT_THEME_DARK` and `BAT_THEME_LIGHT` being ignored, see issue #3171 and PR #3168 (@bash)
|
||||
- Prevent `--list-themes` from outputting default theme info to stdout when it is piped, see #3189 (@einfachIrgendwer0815)
|
||||
- Rename some submodules to fix Dependabot submodule updates, see issue #3198 and PR #3201 (@victor-gp)
|
||||
- Make highlight tests fail when new syntaxes don't have fixtures PR #3255 (@dan-hipschman)
|
||||
- Fix crash for multibyte characters in file path, see issue #3230 and PR #3245 (@HSM95)
|
||||
- Add missing mappings for various bash/zsh files, see PR #3262 (@AdamGaskins)
|
||||
- Send all bat errors to stderr by default, see #3336 (@JerryImMouse)
|
||||
- Make --map-syntax target case insensitive to match --language, see #3206 (@keith-hall)
|
||||
- Correctly determine the end of the line in UTF16LE/BE input #3369 (@keith-hall)
|
||||
|
||||
## Other
|
||||
|
||||
- Update base16 README links to community driven base16 work #2871 (@JamyGolden)
|
||||
- Work around build failures when building `bat` from vendored sources #3179 (@dtolnay)
|
||||
- CICD: Stop building for x86_64-pc-windows-gnu which fails #3261 (Enselic)
|
||||
- CICD: CICD: replace windows-2019 runners with windows-2025 #3339 (@cyqsimon)
|
||||
- Build script: replace string-based codegen with quote-based codegen #3340 (@cyqsimon)
|
||||
- Improve code coverage of `--list-languages` parameter #2942 (@sblondon)
|
||||
- Only start offload worker thread when there's more than 1 core #2956 (@cyqsimon)
|
||||
- Update terminal-colorsaurus (the library used for dark/light detection) to 1.0, see #3347 (@bash)
|
||||
- Update console dependency to 0.16, see #3351 (@musicinmybrain)
|
||||
- Fixed some typos #3244 (@ssbarnea)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Add syntax mapping for `paru` configuration files #3182 (@cyqsimon)
|
||||
- Add support for [Idris 2 programming language](https://www.idris-lang.org/) #3150 (@buzden)
|
||||
- Add syntax mapping for `nix`'s '`flake.lock` lockfiles #3196 (@odilf)
|
||||
- Improvements to CSV/TSV highlighting, with autodetection of delimiter and support for TSV files, see #3186 (@keith-
|
||||
- Improve (Sys)log error highlighting, see #3205 (@keith-hall)
|
||||
- Map `ndjson` extension to JSON syntax, see #3209 (@keith-hall)
|
||||
- Map files with `csproj`, `vbproj`, `props` and `targets` extensions to XML syntax, see #3213 (@keith-hall)
|
||||
- Add debsources syntax to highlight `/etc/apt/sources.list` files, see #3215 (@keith-hall)
|
||||
- Add syntax definition and test file for GDScript highlighting, see #3236 (@chetanjangir0)
|
||||
- Add syntax test file for Odin highlighting, see #3241 (@chetanjangir0)
|
||||
- Update quadlet syntax mapping rules to cover quadlets in subdirectories #3299 (@cyqsimon)
|
||||
- Add syntax Typst #3300 (@cskeeters)
|
||||
- Map `.mill` files to Scala syntax for Mill build tool configuration files #3311 (@krikera)
|
||||
- Add syntax highlighting for VHDL, see #3337 (@JerryImMouse)
|
||||
- Add syntax mapping for certbot certificate configuration #3338 (@cyqsimon)
|
||||
- Update Lean syntax from Lean 3 to Lean 4 #3322 (@YDX-2147483647)
|
||||
- Map `.flatpakref` and `.flatpakrepo` files to INI syntax #3353 (@Ferenc-)
|
||||
- Update hosts syntax #3368 (@keith-hall)
|
||||
|
||||
## Themes
|
||||
|
||||
- Add Catppuccin, see #3317 (@SchweGELBin)
|
||||
- Updated Catppuccin, see #3333 (@SchweGELBin)
|
||||
- Updated gruvbox, see #3372 (@Nicholas42)
|
||||
- Updated GitHub theme, see #3382 (@CosmicHorrorDev)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
# v0.25.0
|
||||
|
||||
## Features
|
||||
|
||||
- Set terminal title to file names when Paging is not Paging::Never #2807 (@Oliver-Looney)
|
||||
- `bat --squeeze-blank`/`bat -s` will now squeeze consecutive empty lines, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||
- `bat --squeeze-limit` to set the maximum number of empty consecutive when using `--squeeze-blank`, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||
- `PrettyPrinter::squeeze_empty_lines` to support line squeezing for bat as a library, see #1441 (@eth-p) and #2665 (@einfachIrgendwer0815)
|
||||
- Syntax highlighting for JavaScript files that start with `#!/usr/bin/env bun` #2913 (@sharunkumar)
|
||||
- `bat --strip-ansi={never,always,auto}` to remove ANSI escape sequences from bat's input, see #2999 (@eth-p)
|
||||
- Add or remove individual style components without replacing all styles #2929 (@eth-p)
|
||||
- Automatically choose theme based on the terminal's color scheme, see #2896 (@bash)
|
||||
- Add option `--binary=as-text` for printing binary content, see issue #2974 and PR #2976 (@einfachIrgendwer0815)
|
||||
- Make shell completions available via `--completion <shell>`, see issue #2057 and PR #3126 (@einfachIrgendwer0815)
|
||||
- Syntax highlighting for puppet code blocks within Markdown files, see #3152 (@liliwilson)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix long file name wrapping in header, see #2835 (@FilipRazek)
|
||||
- Fix `NO_COLOR` support, see #2767 (@acuteenvy)
|
||||
- Fix handling of inputs with OSC ANSI escape sequences, see #2541 and #2544 (@eth-p)
|
||||
- Fix handling of inputs with combined ANSI color and attribute sequences, see #2185 and #2856 (@eth-p)
|
||||
- Fix panel width when line 10000 wraps, see #2854 (@eth-p)
|
||||
- Fix compile issue of `time` dependency caused by standard library regression #3045 (@cyqsimon)
|
||||
- Fix override behavior of --plain and --paging, see issue #2731 and PR #3108 (@einfachIrgendwer0815)
|
||||
- Fix bugs in `$LESSOPEN` support, see #2805 (@Anomalocaridid)
|
||||
|
||||
## Other
|
||||
|
||||
@@ -99,63 +15,19 @@
|
||||
- Minor benchmark script improvements #2768 (@cyqsimon)
|
||||
- Update Arch Linux package URL in README files #2779 (@brunobell)
|
||||
- Update and improve `zsh` completion, see #2772 (@okapia)
|
||||
- More extensible syntax mapping mechanism #2755 (@cyqsimon)
|
||||
- Use proper Architecture for Debian packages built for musl, see #2811 (@Enselic)
|
||||
- Pull in fix for unsafe-libyaml security advisory, see #2812 (@dtolnay)
|
||||
- Update git-version dependency to use Syn v2, see #2816 (@dtolnay)
|
||||
- Update git2 dependency to v0.18.2, see #2852 (@eth-p)
|
||||
- Improve performance when color output disabled, see #2397 and #2857 (@eth-p)
|
||||
- Relax syntax mapping rule restrictions to allow brace expansion #2865 (@cyqsimon)
|
||||
- Apply clippy fixes #2864 (@cyqsimon)
|
||||
- Faster startup by offloading glob matcher building to a worker thread #2868 (@cyqsimon)
|
||||
- Display which theme is the default one in basic output (no colors), see #2937 (@sblondon)
|
||||
- Display which theme is the default one in colored output, see #2838 (@sblondon)
|
||||
- Add aarch64-apple-darwin ("Apple Silicon") binary tarballs to releases, see #2967 (@someposer)
|
||||
- Update the Lisp syntax, see #2970 (@ccqpein)
|
||||
- Use bat's ANSI iterator during tab expansion, see #2998 (@eth-p)
|
||||
- Support 'statically linked binary' for aarch64 in 'Release' page, see #2992 (@tzq0301)
|
||||
- Update options in shell completions and the man page of `bat`, see #2995 (@akinomyoga)
|
||||
- Update nix dev-dependency to v0.29.0, see #3112 (@decathorpe)
|
||||
- Bump MSRV to [1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html), see #3154 (@keith-hall)
|
||||
- Update clircle dependency to remove winapi transitive dependency, see #3113 (@niklasmohrin)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- `cmd-help`: scope subcommands followed by other terms, and other misc improvements, see #2819 (@victor-gp)
|
||||
- Upgrade JQ syntax, see #2820 (@dependabot[bot])
|
||||
- Add syntax mapping for quadman quadlets #2866 (@cyqsimon)
|
||||
- Map containers .conf files to TOML syntax #2867 (@cyqsimon)
|
||||
- Associate `.xsh` files with `xonsh` syntax that is Python, see #2840 (@anki-code)
|
||||
- Associate JSON with Comments `.jsonc` with `json` syntax, see #2795 (@mxaddict)
|
||||
- Associate JSON-LD `.jsonld` files with `json` syntax, see #3037 (@vorburger)
|
||||
- Associate `.textproto` files with `ProtoBuf` syntax, see #3038 (@vorburger)
|
||||
- Associate GeoJSON `.geojson` files with `json` syntax, see #3084 (@mvaaltola)
|
||||
- Associate `.aws/{config,credentials}`, see #2795 (@mxaddict)
|
||||
- Associate Wireguard config `/etc/wireguard/*.conf`, see #2874 (@cyqsimon)
|
||||
- Add support for [CFML](https://www.adobe.com/products/coldfusion-family.html), see #3031 (@brenton-at-pieces)
|
||||
- Map `*.mkd` files to `Markdown` syntax, see issue #3060 and PR #3061 (@einfachIrgendwer0815)
|
||||
- Add syntax mapping for CITATION.cff, see #3103 (@Ugzuzg)
|
||||
- Add syntax mapping for kubernetes config files #3049 (@cyqsimon)
|
||||
- Adds support for pipe delimiter for CSV #3115 (@pratik-m)
|
||||
- Add syntax mapping for `/etc/pacman.conf` #2961 (@cyqsimon)
|
||||
- Associate `uv.lock` with `TOML` syntax, see #3132 (@fepegar)
|
||||
|
||||
## Themes
|
||||
|
||||
- Patched/improved themes for better Manpage syntax highlighting support, see #2994 (@keith-hall).
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
- Changes to `syntax_mapping::SyntaxMapping` #2755 (@cyqsimon)
|
||||
- `SyntaxMapping::get_syntax_for` is now correctly public
|
||||
- [BREAKING] `SyntaxMapping::{empty,builtin}` are removed; use `SyntaxMapping::new` instead
|
||||
- [BREAKING] `SyntaxMapping::mappings` is replaced by `SyntaxMapping::{builtin,custom,all}_mappings`
|
||||
- Make `Controller::run_with_error_handler`'s error handler `FnMut`, see #2831 (@rhysd)
|
||||
- Improve compile time by 20%, see #2815 (@dtolnay)
|
||||
- Add `theme::theme` for choosing an appropriate theme based on the
|
||||
terminal's color scheme, see #2896 (@bash)
|
||||
- [BREAKING] Remove `HighlightingAssets::default_theme`. Use `theme::default_theme` instead.
|
||||
- Add `PrettyPrinter::print_with_writer` for custom output destinations, see #3070 (@kojix2)
|
||||
|
||||
# v0.24.0
|
||||
|
||||
@@ -194,7 +66,6 @@
|
||||
- Update `Julia` syntax, see #2553 (@dependabot)
|
||||
- add `NSIS` support, see #2577 (@idleberg)
|
||||
- Update `ssh-config`, see #2697 (@mrmeszaros)
|
||||
- Add syntax mapping `*.debdiff` => `diff`, see #2947 (@jacg)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
|
@@ -6,42 +6,21 @@ Thank you for considering to contribute to `bat`!
|
||||
|
||||
## Add an entry to the changelog
|
||||
|
||||
Keeping the [`CHANGELOG.md`](CHANGELOG.md) file up-to-date makes the release
|
||||
process much easier and therefore helps to get your changes into a new `bat`
|
||||
release faster. However, not every change to the repository requires a
|
||||
changelog entry. Below are a few examples of that.
|
||||
|
||||
Please update the changelog if your contribution contains changes regarding
|
||||
any of the following:
|
||||
- the behavior of `bat`
|
||||
- syntax mappings
|
||||
- syntax definitions
|
||||
- themes
|
||||
- the build system, linting, or CI workflows
|
||||
|
||||
A changelog entry is not necessary when:
|
||||
- updating documentation
|
||||
- fixing typos
|
||||
|
||||
>[!NOTE]
|
||||
> For PRs, a CI workflow verifies that a suitable changelog entry is
|
||||
> added. If such an entry is missing, the workflow will fail. If your
|
||||
> changes do not need an entry to the changelog (see above), that
|
||||
> workflow failure can be disregarded.
|
||||
|
||||
|
||||
### Changelog entry format
|
||||
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 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.
|
||||
|
||||
Entries must follow this format:
|
||||
Entries follow this format:
|
||||
```
|
||||
- Short description of what has been changed, see #123 (@user)
|
||||
```
|
||||
Please replace `#123` with the number of your pull request (not issue) and
|
||||
`@user` by your GitHub username.
|
||||
Here, `#123` is the number of the original issue and/or your pull request.
|
||||
Please replace `@user` by your GitHub username.
|
||||
|
||||
|
||||
## Development
|
||||
|
1564
Cargo.lock
generated
1564
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
74
Cargo.toml
74
Cargo.toml
@@ -6,12 +6,11 @@ homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT OR Apache-2.0"
|
||||
name = "bat"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.25.0"
|
||||
version = "0.24.0"
|
||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||
build = "build/main.rs"
|
||||
edition = '2021'
|
||||
# You are free to bump MSRV as soon as a reason for bumping emerges.
|
||||
rust-version = "1.74"
|
||||
rust-version = "1.70"
|
||||
|
||||
[features]
|
||||
default = ["application"]
|
||||
@@ -34,7 +33,7 @@ minimal-application = [
|
||||
]
|
||||
git = ["git2"] # Support indicating git modifications
|
||||
paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
|
||||
lessopen = ["execute"] # Support $LESSOPEN preprocessor
|
||||
lessopen = ["run_script", "os_str_bytes"] # Support $LESSOPEN preprocessor
|
||||
build-assets = ["syntect/yaml-load", "syntect/plist-load", "regex", "walkdir"]
|
||||
|
||||
# You need to use one of these if you depend on bat as a library:
|
||||
@@ -42,85 +41,68 @@ regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
|
||||
[dependencies]
|
||||
nu-ansi-term = "0.50.0"
|
||||
nu-ansi-term = "0.49.0"
|
||||
ansi_colours = "^1.2"
|
||||
bincode = "1.0"
|
||||
console = "0.16.0"
|
||||
flate2 = "1.1"
|
||||
once_cell = "1.20"
|
||||
thiserror = "2.0"
|
||||
console = "0.15.7"
|
||||
flate2 = "1.0"
|
||||
once_cell = "1.19"
|
||||
thiserror = "1.0"
|
||||
wild = { version = "2.2", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
shell-words = { version = "1.1.0", optional = true }
|
||||
unicode-width = "0.2.0"
|
||||
unicode-width = "0.1.11"
|
||||
globset = "0.4"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.9.28"
|
||||
semver = "1.0"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
clircle = { version = "0.6.1", default-features = false }
|
||||
clircle = "0.4"
|
||||
bugreport = { version = "0.5.0", optional = true }
|
||||
etcetera = { version = "0.10.0", optional = true }
|
||||
grep-cli = { version = "0.1.11", optional = true }
|
||||
regex = { version = "1.10.6", optional = true }
|
||||
walkdir = { version = "2.5", optional = true }
|
||||
etcetera = { version = "0.8.0", optional = true }
|
||||
grep-cli = { version = "0.1.10", optional = true }
|
||||
regex = { version = "1.10.2", optional = true }
|
||||
walkdir = { version = "2.4", optional = true }
|
||||
bytesize = { version = "1.3.0" }
|
||||
encoding_rs = "0.8.35"
|
||||
execute = { version = "0.2.13", optional = true }
|
||||
terminal-colorsaurus = "1.0"
|
||||
unicode-segmentation = "1.12.0"
|
||||
itertools = "0.13.0"
|
||||
encoding_rs = "0.8.33"
|
||||
os_str_bytes = { version = "~6.6", optional = true }
|
||||
run_script = { version = "^0.10.1", optional = true}
|
||||
|
||||
[dependencies.git2]
|
||||
version = "0.20"
|
||||
version = "0.18"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.syntect]
|
||||
version = "5.2.0"
|
||||
version = "5.1.0"
|
||||
default-features = false
|
||||
features = ["parsing"]
|
||||
|
||||
[dependencies.clap]
|
||||
version = "4.5.46"
|
||||
version = "4.4.12"
|
||||
optional = true
|
||||
features = ["wrap_help", "cargo"]
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
home = "0.5.9"
|
||||
plist = "1.7.0"
|
||||
plist = "1.5.1"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2.0.12"
|
||||
expect-test = "1.5.0"
|
||||
expect-test = "1.4.1"
|
||||
serial_test = { version = "2.0.0", default-features = false }
|
||||
predicates = "3.1.3"
|
||||
predicates = "3.0.4"
|
||||
wait-timeout = "0.2.0"
|
||||
tempfile = "3.16.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tempfile = "3.8.1"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
nix = { version = "0.30", default-features = false, features = ["term"] }
|
||||
nix = { version = "0.26.4", default-features = false, features = ["term"] }
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0.97"
|
||||
indexmap = { version = "2.8.0", features = ["serde"] }
|
||||
itertools = "0.14.0"
|
||||
once_cell = "1.20"
|
||||
prettyplease = "0.2.35"
|
||||
proc-macro2 = "1.0.95"
|
||||
quote = "1.0.40"
|
||||
regex = "1.10.6"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_with = { version = "3.12.0", default-features = false, features = ["macros"] }
|
||||
syn = { version = "2.0.104", features = ["full"] }
|
||||
toml = { version = "0.9.1", features = ["preserve_order"] }
|
||||
walkdir = "2.5"
|
||||
anyhow = "1.0.78"
|
||||
|
||||
[build-dependencies.clap]
|
||||
version = "4.5.46"
|
||||
version = "4.4.12"
|
||||
optional = true
|
||||
features = ["wrap_help", "cargo"]
|
||||
|
||||
|
262
README.md
262
README.md
@@ -22,22 +22,25 @@
|
||||
### Sponsors
|
||||
|
||||
A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
|
||||
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github">
|
||||
<img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
|
||||
<br>
|
||||
<strong>Your app, enterprise-ready.</strong>
|
||||
<br>
|
||||
<sub>Start selling to enterprise customers with just a few lines of code.</sub>
|
||||
<br>
|
||||
<sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
|
||||
</a>
|
||||
|
||||
<p>
|
||||
<a href="https://www.warp.dev/bat">
|
||||
<a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=bat_20231001">
|
||||
<img src="doc/sponsors/warp-logo.png" width="200" alt="Warp">
|
||||
<br>
|
||||
<strong>Warp, the intelligent terminal</strong>
|
||||
<strong>Warp is a modern, Rust-based terminal with AI built in<br>so you and your team can build great software, faster.</strong>
|
||||
<br>
|
||||
<sub>Available on MacOS, Linux, Windows</sub>
|
||||
</a>
|
||||
</p><p>
|
||||
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=bat">
|
||||
<img src="doc/sponsors/graphite-logo.jpeg" width="200" alt="Graphite">
|
||||
<sub>Feel more productive on the command line with parameterized commands,</sub>
|
||||
<br>
|
||||
<strong>Graphite is the AI developer productivity platform helping<br>teams on GitHub ship higher quality software, faster</strong>
|
||||
<sup>autosuggestions, and an IDE-like text editor.</sup>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
### Syntax highlighting
|
||||
|
||||
@@ -121,7 +124,7 @@ bat f - g # output 'f', then stdin, then 'g'.
|
||||
#### `fzf`
|
||||
|
||||
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
||||
use `bat`'s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||
option to restrict the load times for long files:
|
||||
|
||||
```bash
|
||||
@@ -178,7 +181,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
|
||||
highlighting:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --relative --diff-filter=d -z | xargs -0 bat --diff
|
||||
git diff --name-only --relative --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
|
||||
@@ -201,30 +204,24 @@ bat main.cpp | xclip
|
||||
`MANPAGER` environment variable:
|
||||
|
||||
```bash
|
||||
export MANPAGER="sh -c 'awk '\''{ gsub(/\x1B\[[0-9;]*m/, \"\", \$0); gsub(/.\x08/, \"\", \$0); print }'\'' | bat -p -lman'"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
(replace `bat` with `batcat` if you are on Debian or Ubuntu)
|
||||
|
||||
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
||||
formatting problems.
|
||||
|
||||
If you prefer to have this bundled in a new command, you can also use [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
||||
|
||||
> [!WARNING]
|
||||
> This will [not work](https://github.com/sharkdp/bat/issues/1145) out of the box with Mandoc's `man` implementation.
|
||||
>
|
||||
> Please either use `batman`, or convert the shell script to a [shebang executable](https://en.wikipedia.org/wiki/Shebang_(Unix)) and point `MANPAGER` to that.
|
||||
|
||||
Note that the [Manpage syntax](assets/syntaxes/02_Extra/Manpage.sublime-syntax) is developed in this repository and still needs some work.
|
||||
|
||||
Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145) with Mandocs `man` implementation.
|
||||
|
||||
#### `prettier` / `shfmt` / `rustfmt`
|
||||
|
||||
The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`.
|
||||
|
||||
#### `Warp`
|
||||
|
||||
<a href="https://app.warp.dev/drive/folder/-Bat-Warp-Pack-lxhe7HrEwgwpG17mvrFSz1">
|
||||
<img src="doc/sponsors/warp-pack-header.png" alt="Warp">
|
||||
</a>
|
||||
|
||||
#### Highlighting `--help` messages
|
||||
|
||||
You can use `bat` to colorize help text: `$ cp --help | bat -plhelp`
|
||||
@@ -248,32 +245,15 @@ alias -g -- -h='-h 2>&1 | bat --language=help --style=plain'
|
||||
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain'
|
||||
```
|
||||
|
||||
For `fish`, you can use abbreviations:
|
||||
|
||||
```fish
|
||||
abbr -a --position anywhere -- --help '--help | bat -plhelp'
|
||||
abbr -a --position anywhere -- -h '-h | bat -plhelp'
|
||||
```
|
||||
|
||||
This way, you can keep on using `cp --help`, but get colorized help pages.
|
||||
|
||||
Be aware that in some cases, `-h` may not be a shorthand of `--help` (for example with `ls`). In cases where you need to use `-h`
|
||||
as a command argument you can prepend `\` to the arguement (eg. `ls \-h`) to escape the aliasing defined above.
|
||||
Be aware that in some cases, `-h` may not be a shorthand of `--help` (for example with `ls`).
|
||||
|
||||
Please report any issues with the help syntax in [this repository](https://github.com/victor-gp/cmd-help-sublime-syntax).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
<!--
|
||||
|
||||
Installation instructions need to:
|
||||
* be for widely used systems
|
||||
* be non-obvious
|
||||
* be from somewhat official sources
|
||||
|
||||
-->
|
||||
|
||||
[](https://repology.org/project/bat-cat/versions)
|
||||
|
||||
### On Ubuntu (using `apt`)
|
||||
@@ -294,11 +274,6 @@ mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
an example alias for `batcat` as `bat`:
|
||||
```bash
|
||||
alias bat="batcat"
|
||||
```
|
||||
|
||||
### On Ubuntu (using most recent `.deb` packages)
|
||||
*... and other Debian-based Linux distributions.*
|
||||
|
||||
@@ -336,6 +311,14 @@ You can install [the `bat` package](https://koji.fedoraproject.org/koji/packagei
|
||||
dnf install bat
|
||||
```
|
||||
|
||||
### On Funtoo Linux
|
||||
|
||||
You can install [the `bat` package](https://github.com/funtoo/dev-kit/tree/1.4-release/sys-apps/bat) from dev-kit.
|
||||
|
||||
```bash
|
||||
emerge sys-apps/bat
|
||||
```
|
||||
|
||||
### On Gentoo Linux
|
||||
|
||||
You can install [the `bat` package](https://packages.gentoo.org/packages/sys-apps/bat)
|
||||
@@ -345,6 +328,20 @@ from the official sources:
|
||||
emerge sys-apps/bat
|
||||
```
|
||||
|
||||
### On Void Linux
|
||||
|
||||
You can install `bat` via xbps-install:
|
||||
```bash
|
||||
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:
|
||||
@@ -412,7 +409,7 @@ take a look at the ["Using `bat` on Windows"](#using-bat-on-windows) section.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
You will need to install the [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist#latest-microsoft-visual-c-redistributable-version)
|
||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
#### With WinGet
|
||||
|
||||
@@ -450,44 +447,26 @@ binaries are also available: look for archives with `musl` in the file name.
|
||||
|
||||
### From source
|
||||
|
||||
If you want to build `bat` from source, you need Rust 1.74.0 or
|
||||
If you want to build `bat` from source, you need Rust 1.70.0 or
|
||||
higher. You can then use `cargo` to build everything:
|
||||
|
||||
#### From local source
|
||||
```bash
|
||||
cargo install --path . --locked
|
||||
```
|
||||
> [!NOTE]
|
||||
> The `--path .` above specifies the directory of the source code and NOT where `bat` will be installed.
|
||||
> For more information see the docs for [`cargo install`](https://doc.rust-lang.org/cargo/commands/cargo-install.html).
|
||||
|
||||
#### From `crates.io`
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
Note that additional files like the man page or shell completion
|
||||
files can not be installed automatically in both these ways.
|
||||
If installing from a local source, they will be generated by `cargo`
|
||||
and should be available in the cargo target folder under `build`.
|
||||
|
||||
Furthermore, shell completions are also available by running:
|
||||
```bash
|
||||
bat --completion <shell>
|
||||
# see --help for supported shells
|
||||
```
|
||||
files can not be installed in this way. They will be generated by `cargo` and should be available in the cargo target folder (under `build`).
|
||||
|
||||
## Customization
|
||||
|
||||
### Highlighting theme
|
||||
|
||||
Use `bat --list-themes` to get a list of all available themes for syntax
|
||||
highlighting. By default, `bat` uses `Monokai Extended` or `Monokai Extended Light`
|
||||
for dark and light themes respectively. To select the `TwoDark` theme, call `bat`
|
||||
with the `--theme=TwoDark` option or set the `BAT_THEME` environment variable to
|
||||
highlighting. To select the `TwoDark` theme, call `bat` with the
|
||||
`--theme=TwoDark` option or set the `BAT_THEME` environment variable to
|
||||
`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shell's startup file to
|
||||
make the change permanent. Alternatively, use `bat`'s
|
||||
[configuration file](#configuration-file).
|
||||
make the change permanent. Alternatively, use `bat`s
|
||||
[configuration file](https://github.com/sharkdp/bat#configuration-file).
|
||||
|
||||
If you want to preview the different themes on a custom file, you can use
|
||||
the following command (you need [`fzf`](https://github.com/junegunn/fzf) for this):
|
||||
@@ -495,12 +474,10 @@ the following command (you need [`fzf`](https://github.com/junegunn/fzf) for thi
|
||||
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
```
|
||||
|
||||
`bat` automatically picks a fitting theme depending on your terminal's background color.
|
||||
You can use the `--theme-dark` / `--theme-light` options or the `BAT_THEME_DARK` / `BAT_THEME_LIGHT` environment variables
|
||||
to customize the themes used. This is especially useful if you frequently switch between dark and light mode.
|
||||
|
||||
`bat` looks good on a dark background by default. However, if your terminal uses a
|
||||
light background, some themes like `GitHub` or `OneHalfLight` will work better for you.
|
||||
You can also use a custom theme by following the
|
||||
['Adding new themes' section below](#adding-new-themes).
|
||||
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
||||
|
||||
### 8-bit themes
|
||||
|
||||
@@ -509,12 +486,12 @@ even when truecolor support is available:
|
||||
|
||||
- `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/tinted-theming/home) terminal themes. It uses
|
||||
- `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/tinted-theming/home/blob/main/styling.md).
|
||||
- `base16-256` is designed for [tinted-shell](https://github.com/tinted-theming/tinted-shell).
|
||||
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||
- `base16-256` is designed for [base16-shell](https://github.com/chriskempson/base16-shell).
|
||||
It replaces certain bright colors with 8-bit colors from 16 to 21. **Do not** use this simply
|
||||
because you have a 256-color terminal but are not using tinted-shell.
|
||||
because you have a 256-color terminal but are not using base16-shell.
|
||||
|
||||
Although these themes are more restricted, they have three advantages over truecolor themes. They:
|
||||
|
||||
@@ -524,21 +501,11 @@ Although these themes are more restricted, they have three advantages over truec
|
||||
|
||||
### Output style
|
||||
|
||||
You can use the `--style` option to control the appearance of `bat`'s output.
|
||||
You can use the `--style` option to control the appearance of `bat`s output.
|
||||
You can use `--style=numbers,changes`, for example, to show only Git changes
|
||||
and line numbers but no grid and no file header. Set the `BAT_STYLE` environment
|
||||
variable to make these changes permanent or use `bat`'s
|
||||
[configuration file](#configuration-file).
|
||||
|
||||
>[!tip]
|
||||
> If you specify a default style in `bat`'s config file, you can change which components
|
||||
> are displayed during a single run of `bat` using the `--style` command-line argument.
|
||||
> By prefixing a component with `+` or `-`, it can be added or removed from the current style.
|
||||
>
|
||||
> For example, if your config contains `--style=full,-snip`, you can run bat with
|
||||
> `--style=-grid,+snip` to remove the grid and add back the `snip` component.
|
||||
> Or, if you want to override the styles completely, you use `--style=numbers` to
|
||||
> only show the line numbers.
|
||||
variable to make these changes permanent or use `bat`s
|
||||
[configuration file](https://github.com/sharkdp/bat#configuration-file).
|
||||
|
||||
### Adding new syntaxes / language definitions
|
||||
|
||||
@@ -585,8 +552,6 @@ syntax:
|
||||
### Adding new themes
|
||||
|
||||
This works very similar to how we add new syntax definitions.
|
||||
> [!NOTE]
|
||||
> Themes are stored in [`.tmTheme` files](https://www.sublimetext.com/docs/color_schemes_tmtheme.html).
|
||||
|
||||
First, create a folder with the new syntax highlighting themes:
|
||||
```bash
|
||||
@@ -601,8 +566,6 @@ bat cache --build
|
||||
```
|
||||
|
||||
Finally, use `bat --list-themes` to check if the new themes are available.
|
||||
> [!NOTE]
|
||||
> `bat` uses the name of the `.tmTheme` file for the theme's name.
|
||||
|
||||
### Adding or changing file type associations
|
||||
|
||||
@@ -639,52 +602,31 @@ set, `less` is used by default. If you want to use a different pager, you can ei
|
||||
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
||||
`PAGER`.
|
||||
|
||||
>[!NOTE]
|
||||
> If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors.
|
||||
**Note**: If `PAGER` is `more` or `most`, `bat` will silently use `less` instead to ensure support for colors.
|
||||
|
||||
If you want to pass command-line arguments to the pager, you can also set them via the
|
||||
`PAGER`/`BAT_PAGER` variables:
|
||||
|
||||
```bash
|
||||
export BAT_PAGER="less -RFK"
|
||||
export BAT_PAGER="less -RF"
|
||||
```
|
||||
|
||||
Instead of using environment variables, you can also use `bat`'s [configuration file](#configuration-file) to configure the pager (`--pager` option).
|
||||
Instead of using environment variables, you can also use `bat`s [configuration file](https://github.com/sharkdp/bat#configuration-file) to configure the pager (`--pager` option).
|
||||
|
||||
**Note**: By default, if the pager is set to `less` (and no command-line options are specified),
|
||||
`bat` will pass the following command line options to the pager: `-R`/`--RAW-CONTROL-CHARS`,
|
||||
`-F`/`--quit-if-one-screen` and `-X`/`--no-init`. The last option (`-X`) is only used for `less`
|
||||
versions older than 530.
|
||||
|
||||
### Using `less` as a pager
|
||||
The `-R` option is needed to interpret ANSI colors correctly. The second option (`-F`) instructs
|
||||
less to exit immediately if the output size is smaller than the vertical size of the terminal.
|
||||
This is convenient for small files because you do not have to press `q` to quit the pager. The
|
||||
third option (`-X`) is needed to fix a bug with the `--quit-if-one-screen` feature in old versions
|
||||
of `less`. Unfortunately, it also breaks mouse-wheel support in `less`.
|
||||
|
||||
When using `less` as a pager, `bat` will automatically pass extra options along to `less`
|
||||
to improve the experience. Specifically, `-R`/`--RAW-CONTROL-CHARS`, `-F`/`--quit-if-one-screen`,
|
||||
`-K`/`--quit-on-intr` and under certain conditions, `-X`/`--no-init` and/or `-S`/`--chop-long-lines`.
|
||||
|
||||
>[!IMPORTANT]
|
||||
> These options will not be added if:
|
||||
> - The pager is not named `less`.
|
||||
> - The `--pager` argument contains any command-line arguments (e.g. `--pager="less -R"`).
|
||||
> - The `BAT_PAGER` environment variable contains any command-line arguments (e.g. `export BAT_PAGER="less -R"`)
|
||||
>
|
||||
> The `--quit-if-one-screen` option will not be added when:
|
||||
> - The `--paging=always` argument is used.
|
||||
> - The `BAT_PAGING` environment is set to `always`.
|
||||
|
||||
The `-R` option is needed to interpret ANSI colors correctly.
|
||||
|
||||
The `-F` option instructs `less` to exit immediately if the output size is smaller than
|
||||
the vertical size of the terminal. This is convenient for small files because you do not
|
||||
have to press `q` to quit the pager.
|
||||
|
||||
The `-K` option instructs `less` to exit immediately when an interrupt signal is received.
|
||||
This is useful to ensure that `less` quits together with `bat` on SIGINT.
|
||||
|
||||
The `-X` option is needed to fix a bug with the `--quit-if-one-screen` feature in versions
|
||||
of `less` older than version 530. Unfortunately, it also breaks mouse-wheel support in `less`.
|
||||
If you want to enable mouse-wheel scrolling on older versions of `less` and do not mind losing
|
||||
the quit-if-one-screen feature, you can set the pager (via `--pager` or `BAT_PAGER`) to `less -R`.
|
||||
For `less` 530 or newer, it should work out of the box.
|
||||
|
||||
The `-S` option is added when `bat`'s `-S`/`--chop-long-lines` option is used. This tells `less`
|
||||
to truncate any lines larger than the terminal width.
|
||||
If you want to enable mouse-wheel scrolling on older versions of `less`, you can pass just `-R` (as
|
||||
in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer,
|
||||
it should work out of the box.
|
||||
|
||||
### Indentation
|
||||
|
||||
@@ -698,40 +640,12 @@ sidebar. Calling `bat` with `--tabs=0` will override it and let tabs be consumed
|
||||
|
||||
### Dark mode
|
||||
|
||||
If you make use of the dark mode feature in **macOS**, you might want to configure `bat` to use a different
|
||||
If you make use of the dark mode feature in macOS, you might want to configure `bat` to use a different
|
||||
theme based on the OS theme. The following snippet uses the `default` theme when in the _dark mode_
|
||||
and the `GitHub` theme when in the _light mode_.
|
||||
|
||||
```bash
|
||||
alias cat="bat --theme auto:system --theme-dark default --theme-light GitHub"
|
||||
```
|
||||
|
||||
The same dark mode feature is now available in **GNOME** and affects the `org.gnome.desktop.interface color-scheme` setting. The following code converts the above to use said setting.
|
||||
|
||||
```bash
|
||||
# .bashrc
|
||||
sys_color_scheme_is_dark() {
|
||||
condition=$(gsettings get org.gnome.desktop.interface color-scheme)
|
||||
condition=$(echo "$condition" | tr -d "[:space:]'")
|
||||
if [ $condition == "prefer-dark" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
bat_alias_wrapper() {
|
||||
#get color scheme
|
||||
sys_color_scheme_is_dark
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# bat command with dark color scheme
|
||||
bat --theme=default "$@"
|
||||
else
|
||||
# bat command with light color scheme
|
||||
bat --theme=GitHub "$@"
|
||||
fi
|
||||
}
|
||||
alias cat='bat_alias_wrapper'
|
||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||
```
|
||||
|
||||
|
||||
@@ -743,11 +657,10 @@ on your operating system. To get the default path for your system, call
|
||||
bat --config-file
|
||||
```
|
||||
|
||||
Alternatively, you can use `BAT_CONFIG_PATH` or `BAT_CONFIG_DIR` environment variables to point `bat`
|
||||
to a non-default location of the configuration file or the configuration directory respectively:
|
||||
Alternatively, you can use the `BAT_CONFIG_PATH` environment variable to point `bat` to a
|
||||
non-default location of the configuration file:
|
||||
```bash
|
||||
export BAT_CONFIG_PATH="/path/to/bat/bat.conf"
|
||||
export BAT_CONFIG_DIR="/path/to/bat"
|
||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||
```
|
||||
|
||||
A default configuration file can be created with the `--generate-config-file` option.
|
||||
@@ -798,7 +711,7 @@ your `PATH` or [define an environment variable](#using-a-different-pager). The [
|
||||
Windows 10 natively supports colors 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.app/), which includes [ConEmu](https://conemu.github.io/).
|
||||
[Cmder](http://cmder.net/), which includes [ConEmu](https://conemu.github.io/).
|
||||
|
||||
**Note:** Old versions of `less` do not correctly interpret colors on Windows. To fix this, you can add the optional Unix tools to your PATH when installing Git. 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.
|
||||
|
||||
@@ -828,14 +741,9 @@ bat() {
|
||||
|
||||
If an input file contains color codes or other ANSI escape sequences or control characters, `bat` will have problems
|
||||
performing syntax highlighting and text wrapping, and thus the output can become garbled.
|
||||
|
||||
If your version of `bat` supports the `--strip-ansi=auto` option, it can be used to remove such sequences
|
||||
before syntax highlighting. Alternatively, you may disable both syntax highlighting and wrapping by
|
||||
When displaying such files it is recommended to disable both syntax highlighting and wrapping by
|
||||
passing the `--color=never --wrap=never` options to `bat`.
|
||||
|
||||
> [!NOTE]
|
||||
> The `auto` option of `--strip-ansi` avoids removing escape sequences when the syntax is plain text.
|
||||
|
||||
### Terminals & colors
|
||||
|
||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
||||
@@ -887,7 +795,7 @@ bash assets/create.sh
|
||||
cargo install --path . --locked --force
|
||||
```
|
||||
|
||||
If you want to build an application that uses `bat`'s pretty-printing
|
||||
If you want to build an application that uses `bat`s pretty-printing
|
||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
||||
when you depend on `bat` as a library.
|
||||
@@ -905,7 +813,7 @@ Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||
|
||||
## Security vulnerabilities
|
||||
|
||||
See [`SECURITY.md`](SECURITY.md).
|
||||
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
||||
|
||||
## Project goals and alternatives
|
||||
|
||||
|
@@ -1,3 +0,0 @@
|
||||
# Security Vulnerabilities
|
||||
|
||||
To report a security vulnerability, please contact [David Peter](https://david-peter.de/) via email.
|
BIN
assets/acknowledgements.bin
vendored
BIN
assets/acknowledgements.bin
vendored
Binary file not shown.
235
assets/completions/_bat.ps1.in
vendored
235
assets/completions/_bat.ps1.in
vendored
@@ -5,24 +5,6 @@ using namespace System.Management.Automation.Language
|
||||
Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
|
||||
$ArrayStyle = @('default', 'auto', 'full', 'plain', 'changes', 'header', 'header-filename', 'header-filesize', 'grid', 'rule', 'numbers', 'snip')
|
||||
$ArrayCompletion = @('bash', 'fish', 'zsh', 'ps1')
|
||||
$ArrayWhen = @('auto', 'never', 'always')
|
||||
$ArrayYesNo = @('never', 'always')
|
||||
$ArrayWrap = @('always', 'never', 'character')
|
||||
$ArrayBinary = @('no-printing', 'as-text')
|
||||
$ArrayPrint = @('unicode', 'caret')
|
||||
|
||||
function Get-MyThemes(){
|
||||
$themes = {{PROJECT_EXECUTABLE}} --list-themes | ForEach-Object {$_ -replace "^(.*)$", '''$1'''} | select-object
|
||||
return $themes
|
||||
}
|
||||
|
||||
function Get-MyLanguages(){
|
||||
$themes = {{PROJECT_EXECUTABLE}} --list-languages | ForEach-Object{[pscustomobject]@{MyParameter=$_.Substring(0,$_.IndexOf(":")).Trim();MyDescription=$_.Substring($_.IndexOf(":")+1)}} | select-object
|
||||
return $themes
|
||||
}
|
||||
|
||||
$commandElements = $commandAst.CommandElements
|
||||
$command = @(
|
||||
'{{PROJECT_EXECUTABLE}}'
|
||||
@@ -30,167 +12,84 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
|
||||
$element = $commandElements[$i]
|
||||
if ($element -isnot [StringConstantExpressionAst] -or
|
||||
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
||||
#$element.Value.StartsWith('-') -or
|
||||
$element.Value -eq $wordToComplete) {
|
||||
$element.Value.StartsWith('-')) {
|
||||
break
|
||||
}
|
||||
$element.Value
|
||||
}) -join ';'
|
||||
|
||||
$completions = @(switch -Wildcard ($command) {
|
||||
'*;--help' {
|
||||
break
|
||||
}
|
||||
'*;--version' {
|
||||
break
|
||||
}
|
||||
'*;--acknowledgements' {
|
||||
break
|
||||
}
|
||||
'*;--language' {
|
||||
Get-MyLanguages |
|
||||
ForEach-Object {[CompletionResult]::new(($_.MyParameter -replace "^(.*)$", '''$1'''), $_.MyParameter, [CompletionResultType]::ParameterName, $_.MyDescription ?? '_no value_')}
|
||||
break
|
||||
}
|
||||
'*;--theme' {
|
||||
Get-MyThemes |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterName, $_)}
|
||||
break
|
||||
}
|
||||
'*;--binary' {
|
||||
$ArrayBinary |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--style' {
|
||||
$ArrayStyle |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--wrap' {
|
||||
$ArrayWrap |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--color' {
|
||||
$ArrayWhen |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--italic-text' {
|
||||
$ArrayYesNo |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--paging' {
|
||||
$ArrayWhen |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--decorations' {
|
||||
$ArrayWhen |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--completion' {
|
||||
$ArrayCompletion |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--strip-ansi' {
|
||||
$ArrayWhen |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--nonprintable-notation' {
|
||||
$ArrayPrint |
|
||||
ForEach-Object {[System.Management.Automation.CompletionResult]::new($_, $_, [CompletionResultType]::ParameterValue, $_)}
|
||||
break
|
||||
}
|
||||
'*;--generate-config-file' {
|
||||
$completions = @(switch ($command) {
|
||||
'{{PROJECT_EXECUTABLE}}' {
|
||||
[CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||
[CompletionResult]::new('--language', 'language', [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||
[CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||
[CompletionResult]::new('--highlight-line', 'highlight-line', [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||
[CompletionResult]::new('--file-name', 'file-name', [CompletionResultType]::ParameterName, 'Specify the name to display for a file.')
|
||||
[CompletionResult]::new('--diff-context', 'diff-context', [CompletionResultType]::ParameterName, 'diff-context')
|
||||
[CompletionResult]::new('--tabs', 'tabs', [CompletionResultType]::ParameterName, 'Set the tab width to T spaces.')
|
||||
[CompletionResult]::new('--wrap', 'wrap', [CompletionResultType]::ParameterName, 'Specify the text-wrapping mode (*auto*, never, character).')
|
||||
[CompletionResult]::new('--terminal-width', 'terminal-width', [CompletionResultType]::ParameterName, 'Explicitly set the width of the terminal instead of determining it automatically. If prefixed with ''+'' or ''-'', the value will be treated as an offset to the actual terminal width. See also: ''--wrap''.')
|
||||
[CompletionResult]::new('--color', 'color', [CompletionResultType]::ParameterName, 'When to use colors (*auto*, never, always).')
|
||||
[CompletionResult]::new('--italic-text', 'italic-text', [CompletionResultType]::ParameterName, 'Use italics in output (always, *never*)')
|
||||
[CompletionResult]::new('--decorations', 'decorations', [CompletionResultType]::ParameterName, 'When to show the decorations (*auto*, never, always).')
|
||||
[CompletionResult]::new('--paging', 'paging', [CompletionResultType]::ParameterName, 'Specify when to use the pager, or use `-P` to disable (*auto*, never, always).')
|
||||
[CompletionResult]::new('--pager', 'pager', [CompletionResultType]::ParameterName, 'Determine which pager to use.')
|
||||
[CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||
[CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||
[CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
|
||||
[CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).')
|
||||
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||
[CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||
[CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||
[CompletionResult]::new('--show-all', 'show-all', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||
[CompletionResult]::new('--plain', 'plain', [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||
[CompletionResult]::new('--diff', 'diff', [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||
[CompletionResult]::new('--number', 'number', [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||
[CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'f')
|
||||
[CompletionResult]::new('--force-colorization', 'force-colorization', [CompletionResultType]::ParameterName, 'force-colorization')
|
||||
[CompletionResult]::new('-P', 'P', [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||
[CompletionResult]::new('--no-paging', 'no-paging', [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||
[CompletionResult]::new('--list-themes', 'list-themes', [CompletionResultType]::ParameterName, 'Display all supported highlighting themes.')
|
||||
[CompletionResult]::new('-L', 'L', [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||
[CompletionResult]::new('--list-languages', 'list-languages', [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||
[CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'u')
|
||||
[CompletionResult]::new('--unbuffered', 'unbuffered', [CompletionResultType]::ParameterName, 'unbuffered')
|
||||
[CompletionResult]::new('--no-config', 'no-config', [CompletionResultType]::ParameterName, 'Do not use the configuration file')
|
||||
[CompletionResult]::new('--no-custom-assets', 'no-custom-assets', [CompletionResultType]::ParameterName, 'Do not load custom assets')
|
||||
[CompletionResult]::new('--lessopen', 'lessopen', [CompletionResultType]::ParameterName, 'Enable the $LESSOPEN preprocessor')
|
||||
[CompletionResult]::new('--no-lessopen', 'no-lessopen', [CompletionResultType]::ParameterName, 'Disable the $LESSOPEN preprocessor if enabled (overrides --lessopen)')
|
||||
[CompletionResult]::new('--config-file', 'config-file', [CompletionResultType]::ParameterName, 'Show path to the configuration file.')
|
||||
[CompletionResult]::new('--generate-config-file', 'generate-config-file', [CompletionResultType]::ParameterName, 'Generates a default configuration file.')
|
||||
[CompletionResult]::new('--config-dir', 'config-dir', [CompletionResultType]::ParameterName, 'Show bat''s configuration directory.')
|
||||
[CompletionResult]::new('--cache-dir', 'cache-dir', [CompletionResultType]::ParameterName, 'Show bat''s cache directory.')
|
||||
[CompletionResult]::new('--diagnostic', 'diagnostic', [CompletionResultType]::ParameterName, 'Show diagnostic information for bug reports.')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Show version information.')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Show version information.')
|
||||
## Completion of the 'cache' command itself is removed for better UX
|
||||
## See https://github.com/sharkdp/bat/issues/2085#issuecomment-1271646802
|
||||
break
|
||||
}
|
||||
'{{PROJECT_EXECUTABLE}};cache' {
|
||||
[CompletionResult]::new('--source' , 'source' , [CompletionResultType]::ParameterName, 'Use a different directory to load syntaxes and themes from.')
|
||||
[CompletionResult]::new('--target' , 'target' , [CompletionResultType]::ParameterName, 'Use a different directory to store the cached syntax and theme set.')
|
||||
# [CompletionResult]::new('-b' , 'b' , [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||
[CompletionResult]::new('--build' , 'build' , [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||
# [CompletionResult]::new('-c' , 'c' , [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||
[CompletionResult]::new('--clear' , 'clear' , [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||
[CompletionResult]::new('--blank' , 'blank' , [CompletionResultType]::ParameterName, 'Create completely new syntax and theme sets (instead of appending to the default sets).')
|
||||
# [CompletionResult]::new('-h' , 'h' , [CompletionResultType]::ParameterName, 'Prints help information')
|
||||
[CompletionResult]::new('--help' , 'help' , [CompletionResultType]::ParameterName, 'Prints help information')
|
||||
# [CompletionResult]::new('-V' , 'V' , [CompletionResultType]::ParameterName, 'Prints version information')
|
||||
# [CompletionResult]::new('--version' , 'version' , [CompletionResultType]::ParameterName, 'Prints version information')
|
||||
break
|
||||
}
|
||||
default {
|
||||
# [CompletionResult]::new('-l' , 'l' , [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||
[CompletionResult]::new('--language' , 'language' , [CompletionResultType]::ParameterName, 'Set the language for syntax highlighting.')
|
||||
# [CompletionResult]::new('-H' , 'H' , [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||
[CompletionResult]::new('--highlight-line' , 'highlight-line' , [CompletionResultType]::ParameterName, 'Highlight lines N through M.')
|
||||
[CompletionResult]::new('--file-name' , 'file-name' , [CompletionResultType]::ParameterName, 'Specify the name to display for a file.')
|
||||
[CompletionResult]::new('--diff-context' , 'diff-context' , [CompletionResultType]::ParameterName, 'diff-context')
|
||||
[CompletionResult]::new('--tabs' , 'tabs' , [CompletionResultType]::ParameterName, 'Set the tab width to T spaces.')
|
||||
[CompletionResult]::new('--wrap' , 'wrap' , [CompletionResultType]::ParameterName, 'Specify the text-wrapping mode (*auto*, character).')
|
||||
[CompletionResult]::new('--terminal-width' , 'terminal-width' , [CompletionResultType]::ParameterName, 'Explicitly set the width of the terminal instead of determining it automatically. If prefixed with ''+'' or ''-'', the value will be treated as an offset to the actual terminal width. See also: ''--wrap''.')
|
||||
[CompletionResult]::new('--color' , 'color' , [CompletionResultType]::ParameterName, 'When to use colors (*auto*, never, always).')
|
||||
[CompletionResult]::new('--italic-text' , 'italic-text' , [CompletionResultType]::ParameterName, 'Use italics in output (always, *never*)')
|
||||
[CompletionResult]::new('--decorations' , 'decorations' , [CompletionResultType]::ParameterName, 'When to show the decorations (*auto*, never, always).')
|
||||
[CompletionResult]::new('--paging' , 'paging' , [CompletionResultType]::ParameterName, 'Specify when to use the pager, or use ''-P'' to disable (*auto*, never, always).')
|
||||
[CompletionResult]::new('--pager' , 'pager' , [CompletionResultType]::ParameterName, 'Determine which pager to use.')
|
||||
# [CompletionResult]::new('-m' , 'm' , [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||
[CompletionResult]::new('--map-syntax' , 'map-syntax' , [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
|
||||
[CompletionResult]::new('--theme' , 'theme' , [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
|
||||
[CompletionResult]::new('--theme-dark' , 'themedark' , [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting for dark backgrounds.')
|
||||
[CompletionResult]::new('--theme-light' , 'themelight' , [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting for light backgrounds.')
|
||||
[CompletionResult]::new('--style' , 'style' , [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).')
|
||||
# [CompletionResult]::new('-r' , 'r' , [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||
[CompletionResult]::new('--line-range' , 'line-range' , [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
|
||||
# [CompletionResult]::new('-A' , 'A' , [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||
[CompletionResult]::new('--show-all' , 'show-all' , [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')
|
||||
[CompletionResult]::new('--nonprintable-notation' , 'nonprintable-notation' , [CompletionResultType]::ParameterName, 'Set notation for non-printable characters. (unicode, caret)')
|
||||
[CompletionResult]::new('--chop-long-lines' , 'chop-long-lines' , [CompletionResultType]::ParameterName, 'Truncate all lines longer than screen width. Alias for ''--wrap=never''.')
|
||||
[CompletionResult]::new('--binary' , 'binary' , [CompletionResultType]::ParameterName, 'How to treat binary content. (*no-printing*, as-text)')
|
||||
[CompletionResult]::new('--ignored-suffix' , 'ignored-suffix' , [CompletionResultType]::ParameterName, 'Ignore extension. For example: ''bat --ignored-suffix ".dev" my_file.json.dev'' will use JSON syntax, and ignore ''.dev''')
|
||||
[CompletionResult]::new('--squeeze-blank' , 'squeeze-blank' , [CompletionResultType]::ParameterName, 'Squeeze consecutive empty lines into a single empty line.')
|
||||
[CompletionResult]::new('--squeeze-limit' , 'squeeze-limit' , [CompletionResultType]::ParameterName, 'Set the maximum number of consecutive empty lines to be printed.')
|
||||
[CompletionResult]::new('--strip-ansi' , 'strip-ansi' , [CompletionResultType]::ParameterName, 'Specify when to strip ANSI escape sequences from the input. The automatic mode will remove escape sequences unless the syntax highlighting language is plain text. (auto, always, *never*).')
|
||||
# [CompletionResult]::new('-p' , 'p' , [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||
[CompletionResult]::new('--plain' , 'plain' , [CompletionResultType]::ParameterName, 'Show plain style (alias for ''--style=plain'').')
|
||||
# [CompletionResult]::new('-d' , 'd' , [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||
[CompletionResult]::new('--diff' , 'diff' , [CompletionResultType]::ParameterName, 'Only show lines that have been added/removed/modified.')
|
||||
# [CompletionResult]::new('-n' , 'n' , [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||
[CompletionResult]::new('--number' , 'number' , [CompletionResultType]::ParameterName, 'Show line numbers (alias for ''--style=numbers'').')
|
||||
# [CompletionResult]::new('-f' , 'f' , [CompletionResultType]::ParameterName, 'f')
|
||||
[CompletionResult]::new('--force-colorization' , 'force-colorization' , [CompletionResultType]::ParameterName, 'force-colorization')
|
||||
# [CompletionResult]::new('-P' , 'P' , [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||
[CompletionResult]::new('--no-paging' , 'no-paging' , [CompletionResultType]::ParameterName, 'Alias for ''--paging=never''')
|
||||
[CompletionResult]::new('--list-themes' , 'list-themes' , [CompletionResultType]::ParameterName, 'Display all supported highlighting themes.')
|
||||
# [CompletionResult]::new('-L' , 'L' , [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||
[CompletionResult]::new('--list-languages' , 'list-languages' , [CompletionResultType]::ParameterName, 'Display all supported languages.')
|
||||
# [CompletionResult]::new('-u' , 'u' , [CompletionResultType]::ParameterName, 'u')
|
||||
[CompletionResult]::new('--unbuffered' , 'unbuffered' , [CompletionResultType]::ParameterName, 'unbuffered')
|
||||
[CompletionResult]::new('--completion' , 'completion' , [CompletionResultType]::ParameterName, 'Show shell completion for a certain shell. [possible values: bash, fish, zsh, ps1]')
|
||||
[CompletionResult]::new('--no-config' , 'no-config' , [CompletionResultType]::ParameterName, 'Do not use the configuration file')
|
||||
[CompletionResult]::new('--no-custom-assets' , 'no-custom-assets' , [CompletionResultType]::ParameterName, 'Do not load custom assets')
|
||||
[CompletionResult]::new('--lessopen' , 'lessopen' , [CompletionResultType]::ParameterName, 'Enable the $LESSOPEN preprocessor')
|
||||
[CompletionResult]::new('--no-lessopen' , 'no-lessopen' , [CompletionResultType]::ParameterName, 'Disable the $LESSOPEN preprocessor if enabled (overrides --lessopen)')
|
||||
[CompletionResult]::new('--config-file' , 'config-file' , [CompletionResultType]::ParameterName, 'Show path to the configuration file.')
|
||||
[CompletionResult]::new('--generate-config-file' , 'generate-config-file' , [CompletionResultType]::ParameterName, 'Generates a default configuration file.')
|
||||
[CompletionResult]::new('--config-dir' , 'config-dir' , [CompletionResultType]::ParameterName, 'Show bat''s configuration directory.')
|
||||
[CompletionResult]::new('--cache-dir' , 'cache-dir' , [CompletionResultType]::ParameterName, 'Show bat''s cache directory.')
|
||||
[CompletionResult]::new('--acknowledgements' , 'acknowledgements' , [CompletionResultType]::ParameterName, 'Show acknowledgements.')
|
||||
[CompletionResult]::new('--set-terminal-title' , 'set-terminal-title' , [CompletionResultType]::ParameterName, 'Sets terminal title to filenames when using a pager.')
|
||||
[CompletionResult]::new('--diagnostic' , 'diagnostic' , [CompletionResultType]::ParameterName, 'Show diagnostic information for bug reports.')
|
||||
# [CompletionResult]::new('-h' , 'h' , [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||
[CompletionResult]::new('--help' , 'help' , [CompletionResultType]::ParameterName, 'Print this help message.')
|
||||
# [CompletionResult]::new('-V' , 'V' , [CompletionResultType]::ParameterName, 'Show version information.')
|
||||
[CompletionResult]::new('--version' , 'version' , [CompletionResultType]::ParameterName, 'Show version information.')
|
||||
[CompletionResult]::new('--source', 'source', [CompletionResultType]::ParameterName, 'Use a different directory to load syntaxes and themes from.')
|
||||
[CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'Use a different directory to store the cached syntax and theme set.')
|
||||
[CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||
[CompletionResult]::new('--build', 'build', [CompletionResultType]::ParameterName, 'Initialize (or update) the syntax/theme cache.')
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||
[CompletionResult]::new('--clear', 'clear', [CompletionResultType]::ParameterName, 'Remove the cached syntax definitions and themes.')
|
||||
[CompletionResult]::new('--blank', 'blank', [CompletionResultType]::ParameterName, 'Create completely new syntax and theme sets (instead of appending to the default sets).')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information')
|
||||
[CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
||||
Sort-Object -Property CompletionText
|
||||
Sort-Object -Property ListItemText
|
||||
}
|
||||
|
17
assets/completions/bat.bash.in
vendored
17
assets/completions/bat.bash.in
vendored
@@ -76,7 +76,6 @@ _bat() {
|
||||
-m | --map-syntax | \
|
||||
--ignored-suffix | \
|
||||
--list-themes | \
|
||||
--squeeze-limit | \
|
||||
--line-range | \
|
||||
-L | --list-languages | \
|
||||
--lessopen | \
|
||||
@@ -113,13 +112,6 @@ _bat() {
|
||||
return 0
|
||||
;;
|
||||
--theme)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "auto${IFS}auto:always${IFS}auto:system${IFS}dark${IFS}light${IFS}$("$1" --list-themes)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
return 0
|
||||
;;
|
||||
--theme-dark | \
|
||||
--theme-light)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "$("$1" --list-themes)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
@@ -165,7 +157,6 @@ _bat() {
|
||||
--diff-context
|
||||
--tabs
|
||||
--wrap
|
||||
--chop-long-lines
|
||||
--terminal-width
|
||||
--number
|
||||
--color
|
||||
@@ -177,27 +168,19 @@ _bat() {
|
||||
--map-syntax
|
||||
--ignored-suffix
|
||||
--theme
|
||||
--theme-dark
|
||||
--theme-light
|
||||
--list-themes
|
||||
--squeeze-blank
|
||||
--squeeze-limit
|
||||
--style
|
||||
--line-range
|
||||
--list-languages
|
||||
--lessopen
|
||||
--diagnostic
|
||||
--acknowledgements
|
||||
--set-terminal-title
|
||||
--help
|
||||
--version
|
||||
--cache-dir
|
||||
--config-dir
|
||||
--config-file
|
||||
--generate-config-file
|
||||
--no-config
|
||||
--no-custom-assets
|
||||
--no-lessopen
|
||||
" -- "$cur"))
|
||||
return 0
|
||||
fi
|
||||
|
16
assets/completions/bat.fish.in
vendored
16
assets/completions/bat.fish.in
vendored
@@ -129,20 +129,10 @@ set -l tabs_opts '
|
||||
8\t
|
||||
'
|
||||
|
||||
set -l special_themes '
|
||||
auto\tdefault,\ Choose\ a\ theme\ based\ on\ dark\ or\ light\ mode
|
||||
auto:always\tChoose\ a\ theme\ based\ on\ dark\ or\ light\ mode
|
||||
auto:system\tChoose\ a\ theme\ based\ on\ dark\ or\ light\ mode
|
||||
dark\tUse\ the\ theme\ specified\ by\ --theme-dark
|
||||
light\tUse\ the\ theme\ specified\ by\ --theme-light
|
||||
'
|
||||
|
||||
# Completions:
|
||||
|
||||
complete -c $bat -l acknowledgements -d "Print acknowledgements" -n __fish_is_first_arg
|
||||
|
||||
complete -c $bat -l cache-dir -f -d "Show bat's cache directory" -n __fish_is_first_arg
|
||||
|
||||
complete -c $bat -l color -x -a "$color_opts" -d "When to use colored output" -n __bat_no_excl_args
|
||||
|
||||
complete -c $bat -l config-dir -f -d "Display location of configuration directory" -n __fish_is_first_arg
|
||||
@@ -211,11 +201,7 @@ complete -c $bat -l tabs -x -a "$tabs_opts" -d "Set tab width" -n __bat_no_excl_
|
||||
|
||||
complete -c $bat -l terminal-width -x -d "Set terminal <width>, +<offset>, or -<offset>" -n __bat_no_excl_args
|
||||
|
||||
complete -c $bat -l theme -x -a "$special_themes(command $bat --list-themes | command cat)" -d "Set the syntax highlighting theme" -n __bat_no_excl_args
|
||||
|
||||
complete -c $bat -l theme-dark -x -a "(command $bat --list-themes | command cat)" -d "Set the syntax highlighting theme for dark backgrounds" -n __bat_no_excl_args
|
||||
|
||||
complete -c $bat -l theme-light -x -a "(command $bat --list-themes | command cat)" -d "Set the syntax highlighting theme for light backgrounds" -n __bat_no_excl_args
|
||||
complete -c $bat -l theme -x -a "(command $bat --list-themes | command cat)" -d "Set the syntax highlighting theme" -n __bat_no_excl_args
|
||||
|
||||
complete -c $bat -s V -l version -f -d "Show version information" -n __fish_is_first_arg
|
||||
|
||||
|
15
assets/completions/bat.zsh.in
vendored
15
assets/completions/bat.zsh.in
vendored
@@ -26,7 +26,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
||||
args=(
|
||||
'(-A --show-all)'{-A,--show-all}'[show non-printable characters (space, tab, newline, ..)]'
|
||||
--nonprintable-notation='[specify how to display non-printable characters when using --show-all]:notation:(caret unicode)'
|
||||
\*{-p,--plain}'[show plain style (alias for `--style=plain`), repeat twice to disable automatic paging (alias for `--paging=never`)]'
|
||||
\*{-p,--plain}'[show plain style (alias for `--style=plain`), repeat twice to disable disable automatic paging (alias for `--paging=never`)]'
|
||||
'(-l --language)'{-l+,--language=}'[set the language for syntax highlighting]:language:->languages'
|
||||
\*{-H+,--highlight-line=}'[highlight specified block of lines]:start\:end'
|
||||
\*--file-name='[specify the name to display for a file]:name:_files'
|
||||
@@ -42,15 +42,12 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
||||
--decorations='[specify when to show the decorations]:when:(auto never always)'
|
||||
--paging='[specify when to use the pager]:when:(auto never always)'
|
||||
'(-m --map-syntax)'{-m+,--map-syntax=}'[map a glob pattern to an existing syntax name]: :->syntax-maps'
|
||||
'(--theme)'--theme='[set the color theme for syntax highlighting]:theme:->theme_preferences'
|
||||
'(--theme-dark)'--theme-dark='[set the color theme for syntax highlighting for dark backgrounds]:theme:->themes'
|
||||
'(--theme-light)'--theme-light='[set the color theme for syntax highlighting for light backgrounds]:theme:->themes'
|
||||
'(--theme)'--theme='[set the color theme for syntax highlighting]:theme:->themes'
|
||||
'(: --list-themes --list-languages -L)'--list-themes'[show all supported highlighting themes]'
|
||||
--style='[comma-separated list of style elements to display]: : _values "style [default]"
|
||||
default auto full plain changes header header-filename header-filesize grid rule numbers snip'
|
||||
\*{-r+,--line-range=}'[only print the specified line range]:start\:end'
|
||||
'(* -)'{-L,--list-languages}'[display all supported languages]'
|
||||
-P'[disable paging]'
|
||||
"--no-config[don't use the configuration file]"
|
||||
"--no-custom-assets[don't load custom assets]"
|
||||
'(--no-lessopen)'--lessopen'[enable the $LESSOPEN preprocessor]'
|
||||
@@ -84,13 +81,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
||||
|
||||
themes)
|
||||
local -a themes expl
|
||||
themes=(${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --list-themes)"} )
|
||||
|
||||
_wanted themes expl 'theme' compadd -a themes && ret=0
|
||||
;;
|
||||
theme_preferences)
|
||||
local -a themes expl
|
||||
themes=(auto dark light auto:always auto:system ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --list-themes)"} )
|
||||
themes=( ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --list-themes)"} )
|
||||
|
||||
_wanted themes expl 'theme' compadd -a themes && ret=0
|
||||
;;
|
||||
|
141
assets/manual/bat.1.in
vendored
141
assets/manual/bat.1.in
vendored
@@ -37,23 +37,6 @@ Use character sequences like ^G, ^J, ^@, .. to identify non-printable characters
|
||||
Use special Unicode code points to identify non-printable characters
|
||||
.RE
|
||||
.HP
|
||||
\fB\-\-binary\fR <behavior>
|
||||
.IP
|
||||
How to treat binary content.
|
||||
|
||||
Possible values:
|
||||
.RS
|
||||
.IP "no\-printing"
|
||||
Do not print any binary content (default)
|
||||
.IP "as\-text"
|
||||
Treat binary content as normal text
|
||||
.RE
|
||||
.HP
|
||||
\fB\-\-completion\fR <SHELL>
|
||||
.IP
|
||||
Show shell completion for a certain shell.
|
||||
Possible values: bash, fish, zsh, ps1
|
||||
.HP
|
||||
\fB\-p\fR, \fB\-\-plain\fR
|
||||
.IP
|
||||
Only show plain style, no decorations. This is an alias for
|
||||
@@ -104,10 +87,6 @@ Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
|
||||
Specify the text\-wrapping mode (*auto*, never, character). The '\-\-terminal\-width' option
|
||||
can be used in addition to control the output width.
|
||||
.HP
|
||||
\fB\-S\fR, \fB\-\-chop\-long\-lines\fR
|
||||
.IP
|
||||
Truncate all lines longer than screen width. Alias for '\-\-wrap=never'.
|
||||
.HP
|
||||
\fB\-\-terminal\-width\fR <width>
|
||||
.IP
|
||||
Explicitly set the width of the terminal instead of determining it automatically. If
|
||||
@@ -162,82 +141,24 @@ use -m '*.build:Python'. To highlight files named '.myignore' with the Git Ignor
|
||||
syntax, use -m '.myignore:Git Ignore'.
|
||||
Note that the right-hand side is the *name* of the syntax, not a file extension.
|
||||
.HP
|
||||
\fB\-\-ignored\-suffix\fR <ignored-suffix>
|
||||
.IP
|
||||
Ignore extension. For example: 'bat \-\-ignored-suffix ".dev" my_file.json.dev'
|
||||
will use JSON syntax, and ignore '.dev'
|
||||
.HP
|
||||
\fB\-\-theme\fR <theme>
|
||||
.IP
|
||||
Set the theme for syntax highlighting. Use \fB\-\-list\-themes\fP to see all available themes.
|
||||
To set a default theme, add the \fB\-\-theme="..."\fP option to the configuration file or
|
||||
export the \fBBAT_THEME\fP environment variable (e.g.: \fBexport BAT_THEME="..."\fP).
|
||||
|
||||
Special values:
|
||||
.RS
|
||||
.IP "auto (\fIdefault\fR)"
|
||||
Picks a dark or light theme depending on the terminal's colors.
|
||||
Use \fB-\-theme\-light\fR and \fB-\-theme\-dark\fR to customize the selected theme.
|
||||
.IP "auto:always"
|
||||
Variation of \fBauto\fR where where the terminal's colors are detected even when the output is redirected.
|
||||
.IP "auto:system (macOS only)"
|
||||
Variation of \fBauto\fR where the color scheme is detected from the system-wide preference instead.
|
||||
.IP "dark"
|
||||
Use the dark theme specified by \fB-\-theme-dark\fR.
|
||||
.IP "light"
|
||||
Use the light theme specified by \fB-\-theme-light\fR.
|
||||
.RE
|
||||
.HP
|
||||
\fB\-\-theme\-dark\fR <theme>
|
||||
.IP
|
||||
Sets the theme name for syntax highlighting used when the terminal uses a dark background.
|
||||
To set a default theme, add the \fB\-\-theme-dark="..."\fP option to the configuration file or
|
||||
export the \fBBAT_THEME_DARK\fP environment variable (e.g. \fBexport BAT_THEME_DARK="..."\fP).
|
||||
This option only has an effect when \fB\-\-theme\fP option is set to \fBauto\fR or \fBdark\fR.
|
||||
.HP
|
||||
\fB\-\-theme\-light\fR <theme>
|
||||
.IP
|
||||
Sets the theme name for syntax highlighting used when the terminal uses a light background.
|
||||
To set a default theme, add the \fB\-\-theme-light="..."\fP option to the configuration file or
|
||||
export the \fBBAT_THEME_LIGHT\fP environment variable (e.g. \fBexport BAT_THEME_LIGHT="..."\fP).
|
||||
This option only has an effect when \fB\-\-theme\fP option is set to \fBauto\fR or \fBlight\fR.
|
||||
Set the theme for syntax highlighting. Use '\-\-list\-themes' to see all available themes.
|
||||
To set a default theme, add the '\-\-theme="..."' option to the configuration file or
|
||||
export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
|
||||
.HP
|
||||
\fB\-\-list\-themes\fR
|
||||
.IP
|
||||
Display a list of supported themes for syntax highlighting.
|
||||
.HP
|
||||
\fB\-s\fR, \fB\-\-squeeze\-blank\fR
|
||||
.IP
|
||||
Squeeze consecutive empty lines into a single empty line.
|
||||
.HP
|
||||
\fB\-\-squeeze\-limit\fR <squeeze-limit>
|
||||
.IP
|
||||
Set the maximum number of consecutive empty lines to be printed.
|
||||
.HP
|
||||
\fB\-\-strip\-ansi\fR <when>
|
||||
.IP
|
||||
Specify when to strip ANSI escape sequences from the input. The automatic mode will remove
|
||||
escape sequences unless the syntax highlighting language is plain text. Possible values:
|
||||
auto, always, *never*.
|
||||
.HP
|
||||
\fB\-\-style\fR <style\-components>
|
||||
.IP
|
||||
Configure which elements (line numbers, file headers, grid borders, Git modifications,
|
||||
\&..) to display in addition to the file contents. The argument is a comma\-separated list
|
||||
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
|
||||
To set a default style, add the '\-\-style=".."' option to the configuration file or
|
||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE="..").
|
||||
.IP
|
||||
When styles are specified in multiple places, the "nearest" set of styles take precedence.
|
||||
The command\-line arguments are the highest priority, followed by the BAT_STYLE environment
|
||||
variable, and then the configuration file. If any set of styles consists entirely of
|
||||
components prefixed with "+" or "\-", it will modify the previous set of styles instead of
|
||||
replacing them.
|
||||
.IP
|
||||
By default, the following components are enabled:
|
||||
changes, grid, header\-filename, numbers, snip
|
||||
.IP
|
||||
Possible values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
|
||||
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
|
||||
values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
|
||||
rule, numbers, snip.
|
||||
.HP
|
||||
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
|
||||
@@ -263,30 +184,6 @@ Display a list of supported languages for syntax highlighting.
|
||||
This option exists for POSIX\-compliance reasons ('u' is for 'unbuffered'). The output is
|
||||
always unbuffered \- this option is simply ignored.
|
||||
.HP
|
||||
\fB\-\-no\-custom\-assets\fR
|
||||
.IP
|
||||
Do not load custom assets.
|
||||
.HP
|
||||
\fB\-\-config\-dir\fR
|
||||
.IP
|
||||
Show bat's configuration directory.
|
||||
.HP
|
||||
\fB\-\-cache\-dir\fR
|
||||
.IP
|
||||
Show bat's cache directory.
|
||||
.HP
|
||||
\fB\-\-diagnostic\fR
|
||||
.IP
|
||||
Show diagnostic information for bug reports.
|
||||
.HP
|
||||
\fB\-\-acknowledgements\fR
|
||||
.IP
|
||||
Show acknowledgements.
|
||||
.HP
|
||||
\fB\-\-set\-terminal\-title\fR
|
||||
.IP
|
||||
Sets terminal title to filenames when using a pager.
|
||||
.HP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
.IP
|
||||
Print this help message.
|
||||
@@ -315,20 +212,6 @@ location of the configuration file.
|
||||
To generate a default configuration file, call:
|
||||
|
||||
\fB{{PROJECT_EXECUTABLE}} --generate-config-file\fR
|
||||
|
||||
These are related options:
|
||||
.HP
|
||||
\fB\-\-config\-file\fR
|
||||
.IP
|
||||
Show path to the configuration file.
|
||||
.HP
|
||||
\fB\-\-generate-config\-file\fR
|
||||
.IP
|
||||
Generates a default configuration file.
|
||||
.HP
|
||||
\fB\-\-no\-config\fR
|
||||
.IP
|
||||
Do not use the configuration file.
|
||||
.SH "ADDING CUSTOM LANGUAGES"
|
||||
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB.sublime-syntax\fR language files, and can be
|
||||
customized to add additional languages to your local installation. To do this, add the \fB.sublime-syntax\fR language
|
||||
@@ -369,23 +252,13 @@ To use the preprocessor, call:
|
||||
|
||||
\fB{{PROJECT_EXECUTABLE}} --lessopen\fR
|
||||
|
||||
Alternatively, the preprocessor may be enabled by default by adding the '\-\-lessopen' option to the configuration file.
|
||||
Alternatively, the preprocessor may be enabled by default by adding the '\-\-lessopen' option to the configuration file.
|
||||
|
||||
To temporarily disable the preprocessor if it is enabled by default, call:
|
||||
|
||||
\fB{{PROJECT_EXECUTABLE}} --no-lessopen\fR
|
||||
|
||||
These are related options:
|
||||
.HP
|
||||
\fB\-\-lessopen\fR
|
||||
.IP
|
||||
Enable the $LESSOPEN preprocessor.
|
||||
.HP
|
||||
\fB\-\-no\-lessopen\fR
|
||||
.IP
|
||||
Disable the $LESSOPEN preprocessor if enabled (overrides --lessopen)
|
||||
.PP
|
||||
For more information, see the "INPUT PREPROCESSOR" section of less(1).
|
||||
For more information, see the "INPUT PREPROCESSOR" section of less(1).
|
||||
|
||||
.SH "MORE INFORMATION"
|
||||
|
||||
|
22
assets/patches/1337.tmTheme.patch
vendored
22
assets/patches/1337.tmTheme.patch
vendored
@@ -1,22 +0,0 @@
|
||||
diff --git themes/1337-Scheme/1337.tmTheme themes/1337-Scheme/1337.tmTheme
|
||||
index fdff5bf..8cfc888 100644
|
||||
--- themes/1337-Scheme/1337.tmTheme
|
||||
+++ themes/1337-Scheme/1337.tmTheme
|
||||
@@ -280,7 +280,7 @@ SOFTWARE.
|
||||
<key>name</key>
|
||||
<string>PHP Namespaces</string>
|
||||
<key>scope</key>
|
||||
- <string>support.other.namespace, entity.name.type.namespace</string>
|
||||
+ <string>support.other.namespace, entity.name.type.namespace, entity.name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -561,7 +561,7 @@ SOFTWARE.
|
||||
<key>name</key>
|
||||
<string>diff.header</string>
|
||||
<key>scope</key>
|
||||
- <string>meta.diff, meta.diff.header</string>
|
||||
+ <string>meta.diff, meta.diff.header, markup.heading</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
14
assets/patches/JavaScript.sublime-syntax.patch
vendored
14
assets/patches/JavaScript.sublime-syntax.patch
vendored
@@ -1,14 +0,0 @@
|
||||
Submodule assets/syntaxes/01_Packages contains modified content
|
||||
diff --git syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||
index 05a4fed6..78a7bf55 100644
|
||||
--- syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||
+++ syntaxes/01_Packages/JavaScript/JavaScript.sublime-syntax
|
||||
@@ -5,7 +5,7 @@ name: JavaScript
|
||||
file_extensions:
|
||||
- js
|
||||
- htc
|
||||
-first_line_match: ^#!\s*/.*\b(node|js)\b
|
||||
+first_line_match: ^#!\s*/.*\b(node|bun|js)\b
|
||||
scope: source.js
|
||||
variables:
|
||||
bin_digit: '[01_]'
|
2365
assets/patches/Lisp.sublime-syntax.patch
vendored
2365
assets/patches/Lisp.sublime-syntax.patch
vendored
File diff suppressed because one or more lines are too long
26
assets/patches/Markdown.sublime-syntax.patch
vendored
26
assets/patches/Markdown.sublime-syntax.patch
vendored
@@ -1,5 +1,5 @@
|
||||
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
index 19dc685d..3a45ea05 100644
|
||||
index 19dc685d..44440c7f 100644
|
||||
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||
@@ -24,7 +24,6 @@ variables:
|
||||
@@ -166,29 +166,7 @@ index 19dc685d..3a45ea05 100644
|
||||
- match: ^\s*$\n?
|
||||
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
||||
pop: true
|
||||
@@ -1073,6 +1031,21 @@ contexts:
|
||||
escape: '{{code_fence_escape}}'
|
||||
escape_captures:
|
||||
0: meta.code-fence.definition.end.python.markdown-gfm
|
||||
+ 1: punctuation.definition.raw.code-fence.end.markdown
|
||||
+ - match: |-
|
||||
+ (?x)
|
||||
+ {{fenced_code_block_start}}
|
||||
+ ((?i:puppet))
|
||||
+ {{fenced_code_block_trailing_infostring_characters}}
|
||||
+ captures:
|
||||
+ 0: meta.code-fence.definition.begin.puppet.markdown-gfm
|
||||
+ 2: punctuation.definition.raw.code-fence.begin.markdown
|
||||
+ 5: constant.other.language-name.markdown
|
||||
+ embed: scope:source.puppet
|
||||
+ embed_scope: markup.raw.code-fence.puppet.markdown-gfm
|
||||
+ escape: '{{code_fence_escape}}'
|
||||
+ escape_captures:
|
||||
+ 0: meta.code-fence.definition.end.puppet.markdown-gfm
|
||||
1: punctuation.definition.raw.code-fence.end.markdown
|
||||
- match: |-
|
||||
(?x)
|
||||
@@ -1152,7 +1125,7 @@ contexts:
|
||||
@@ -1152,7 +1110,7 @@ contexts:
|
||||
- match: |-
|
||||
(?x)
|
||||
{{fenced_code_block_start}}
|
||||
|
19
assets/patches/Monokai-Extended.tmTheme.patch
vendored
19
assets/patches/Monokai-Extended.tmTheme.patch
vendored
@@ -21,26 +21,11 @@ index 9c2aa3e..180cbbf 100644
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid</string>
|
||||
+ <string>invalid, meta.annotation.error-line</string>
|
||||
+ <string>invalid, markup.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
@@ -1038,11 +1038,22 @@
|
||||
<string>#f8f8f0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
+ <dict>
|
||||
+ <key>name</key>
|
||||
+ <string>Error</string>
|
||||
+ <key>scope</key>
|
||||
+ <string>markup.error</string>
|
||||
+ <key>settings</key>
|
||||
+ <dict>
|
||||
+ <key>foreground</key>
|
||||
+ <string>#dd2020</string>
|
||||
+ </dict>
|
||||
+ </dict>
|
||||
<dict>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
|
47
assets/patches/OneHalfDark.tmTheme.patch
vendored
47
assets/patches/OneHalfDark.tmTheme.patch
vendored
@@ -1,47 +0,0 @@
|
||||
diff --git themes/onehalf/sublimetext/OneHalfDark.tmTheme themes/onehalf/sublimetext/OneHalfDark.tmTheme
|
||||
index b16050c..b021071 100644
|
||||
--- themes/onehalf/sublimetext/OneHalfDark.tmTheme
|
||||
+++ themes/onehalf/sublimetext/OneHalfDark.tmTheme
|
||||
@@ -28,7 +28,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>name</key>
|
||||
- <string>OneHalfLight</string>
|
||||
+ <string>OneHalfDark</string>
|
||||
<key>semanticClass</key>
|
||||
<string>theme.dark.one_half_dark</string>
|
||||
<key>uuid</key>
|
||||
@@ -155,7 +155,7 @@
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
- <string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
+ <string>support.class, entity.name.class, entity.name.type.class, entity.name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -188,7 +188,7 @@
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
- <string>storage</string>
|
||||
+ <string>storage, meta.mapping.key string</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -309,7 +309,7 @@
|
||||
<key>name</key>
|
||||
<string>Markdown: Headings</string>
|
||||
<key>scope</key>
|
||||
- <string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
+ <string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
@@ -660,4 +660,4 @@
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
-</plist>
|
||||
\ No newline at end of file
|
||||
+</plist>
|
18
assets/patches/TwoDark.tmTheme.patch
vendored
18
assets/patches/TwoDark.tmTheme.patch
vendored
@@ -2,24 +2,6 @@ diff --git themes/TwoDark/TwoDark.tmTheme themes/TwoDark/TwoDark.tmTheme
|
||||
index 87fd358..56376d3 100644
|
||||
--- themes/TwoDark/TwoDark.tmTheme
|
||||
+++ themes/TwoDark/TwoDark.tmTheme
|
||||
@@ -125,7 +125,7 @@
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
- <string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
+ <string>support.class, entity.name.class, entity.name.type.class, entity.name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -290,7 +290,7 @@
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
- <string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
+ <string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
@@ -533,7 +533,7 @@
|
||||
<key>name</key>
|
||||
<string>Json key</string>
|
||||
|
BIN
assets/syntaxes.bin
vendored
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/Apache
vendored
2
assets/syntaxes/02_Extra/Apache
vendored
Submodule assets/syntaxes/02_Extra/Apache updated: c438c352db...163bc03ae8
@@ -1,6 +1,5 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
name: x86_64 Assembly
|
||||
file_extensions: [yasm, nasm, asm, inc, mac]
|
||||
scope: source.asm.x86_64
|
||||
|
||||
@@ -1365,3 +1364,4 @@ contexts:
|
||||
scope: invalid.keyword.operator.word.mnemonic.sse5.packed-arithmetic
|
||||
- match: '(?i)\b(pcmov|permp[ds]|pperm|prot[bdqw]|psh[al][bdqw])\b'
|
||||
scope: invalid.keyword.operator.word.mnemonic.sse5.simd-integer
|
||||
...
|
1
assets/syntaxes/02_Extra/CFML
vendored
1
assets/syntaxes/02_Extra/CFML
vendored
Submodule assets/syntaxes/02_Extra/CFML deleted from b91c44a32e
@@ -2,21 +2,20 @@
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Comma Separated Values
|
||||
scope: text.csv.comma
|
||||
file_extensions:
|
||||
- csv
|
||||
- tsv
|
||||
scope: text.csv
|
||||
variables:
|
||||
field_separator: (?:,)
|
||||
field_separator: (?:[,;\t])
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
main:
|
||||
- match: '^'
|
||||
push: fields
|
||||
|
||||
prototype:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
fields:
|
||||
- include: record_separator
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field5
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
@@ -25,20 +24,16 @@ contexts:
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
main:
|
||||
- meta_include_prototype: false
|
||||
- match: '^'
|
||||
set: fields
|
||||
|
||||
record_separator_pop:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
|
||||
record_separator:
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- include: record_separator_pop
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
@@ -46,16 +41,24 @@ contexts:
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: scope:text.csv#double_quoted_string
|
||||
push: double_quoted_string
|
||||
|
||||
- include: record_separator_pop
|
||||
- match: (?={{field_separator}})
|
||||
- match: (?={{field_separator}}|{{record_separator}})
|
||||
pop: true
|
||||
|
||||
double_quoted_string:
|
||||
- meta_include_prototype: false
|
||||
- meta_scope: string.quoted.double.csv
|
||||
- match: '""'
|
||||
scope: constant.character.escape.csv
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.csv
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv variable.parameter
|
||||
- meta_content_scope: meta.field-1.csv support.type
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
@@ -72,8 +75,4 @@ contexts:
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
field5:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-5.csv string.unquoted
|
||||
- include: field_contents
|
||||
|
@@ -1,80 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Pipe Separated Values
|
||||
scope: text.csv.pipe
|
||||
variables:
|
||||
field_separator: (?:\|)
|
||||
record_separator: (?:$\n?)
|
||||
|
||||
contexts:
|
||||
main:
|
||||
- match: '^'
|
||||
push: fields
|
||||
|
||||
fields:
|
||||
- include: record_separator
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field5
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
|
||||
record_separator_pop:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
|
||||
record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- include: record_separator_pop
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: scope:text.csv#double_quoted_string
|
||||
|
||||
- include: record_separator_pop
|
||||
- match: (?={{field_separator}})
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv variable.parameter
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
field5:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-5.csv string.unquoted
|
||||
- include: field_contents
|
@@ -1,79 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Semi-Colon Separated Values
|
||||
scope: text.csv.semi-colon
|
||||
variables:
|
||||
field_separator: (?:;)
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
main:
|
||||
- match: '^'
|
||||
push: fields
|
||||
|
||||
fields:
|
||||
- include: record_separator
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field5
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
|
||||
record_separator_pop:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
|
||||
record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- include: record_separator_pop
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: scope:text.csv#double_quoted_string
|
||||
|
||||
- include: record_separator_pop
|
||||
- match: (?={{field_separator}})
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv variable.parameter
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
field5:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-5.csv string.unquoted
|
||||
- include: field_contents
|
113
assets/syntaxes/02_Extra/CSV/CSV.sublime-syntax
vendored
113
assets/syntaxes/02_Extra/CSV/CSV.sublime-syntax
vendored
@@ -1,113 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Separated Values
|
||||
file_extensions:
|
||||
- csv
|
||||
scope: text.csv
|
||||
variables:
|
||||
field_separator_chars: ',;\t|'
|
||||
field_separator: (?:[{{field_separator_chars}}])
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
main:
|
||||
- meta_include_prototype: false
|
||||
- include: three_field_separators
|
||||
- include: single_separator_type_on_line
|
||||
- match: '^'
|
||||
push: unknown-separated-main
|
||||
|
||||
three_field_separators:
|
||||
- match: ^(?=(?:[^,]*,){3})
|
||||
set: scope:text.csv.comma
|
||||
- match: ^(?=(?:[^;]*;){3})
|
||||
set: scope:text.csv.semi-colon
|
||||
- match: ^(?=(?:[^\t]*\t){3})
|
||||
set: scope:text.csv.tab
|
||||
- match: ^(?=(?:[^|]*\|){3})
|
||||
set: scope:text.csv.pipe
|
||||
|
||||
single_separator_type_on_line:
|
||||
- match: ^(?=[^{{field_separator_chars}}]*,[^;\t|]*$)
|
||||
set: scope:text.csv.comma
|
||||
- match: ^(?=[^{{field_separator_chars}}]*;[^,\t|]*$)
|
||||
set: scope:text.csv.semi-colon
|
||||
- match: ^(?=[^{{field_separator_chars}}]*\t[^,;|]*$)
|
||||
set: scope:text.csv.tab
|
||||
- match: ^(?=[^{{field_separator_chars}}]*\|[^,;\t]*$)
|
||||
set: scope:text.csv.pipe
|
||||
|
||||
unknown-separated-main:
|
||||
- include: record_separator
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field5
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
|
||||
record_separator_pop:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
|
||||
record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- include: record_separator_pop
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: double_quoted_string
|
||||
|
||||
- include: record_separator_pop
|
||||
- match: (?={{field_separator}})
|
||||
pop: true
|
||||
|
||||
double_quoted_string:
|
||||
- meta_include_prototype: false
|
||||
- meta_scope: string.quoted.double.csv
|
||||
- match: '""'
|
||||
scope: constant.character.escape.csv
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.csv
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv variable.parameter
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
field5:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-5.csv string.unquoted
|
||||
- include: field_contents
|
83
assets/syntaxes/02_Extra/CSV/TSV.sublime-syntax
vendored
83
assets/syntaxes/02_Extra/CSV/TSV.sublime-syntax
vendored
@@ -1,83 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Tab Separated Values
|
||||
scope: text.csv.tab
|
||||
file_extensions:
|
||||
- tsv
|
||||
|
||||
variables:
|
||||
field_separator: (?:\t)
|
||||
record_separator: (?:$\n?)
|
||||
|
||||
contexts:
|
||||
main:
|
||||
- match: '^'
|
||||
push: fields
|
||||
|
||||
fields:
|
||||
- include: record_separator
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field5
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
|
||||
record_separator_pop:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
|
||||
record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- include: record_separator_pop
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: scope:text.csv#double_quoted_string
|
||||
|
||||
- include: record_separator_pop
|
||||
- match: (?={{field_separator}})
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv variable.parameter
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
field5:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-5.csv string.unquoted
|
||||
- include: field_contents
|
2
assets/syntaxes/02_Extra/Docker
vendored
2
assets/syntaxes/02_Extra/Docker
vendored
Submodule assets/syntaxes/02_Extra/Docker updated: c001fb2805...0f6b7bc87a
2
assets/syntaxes/02_Extra/Fish
vendored
2
assets/syntaxes/02_Extra/Fish
vendored
Submodule assets/syntaxes/02_Extra/Fish updated: ef510fd759...98316d4332
1
assets/syntaxes/02_Extra/GDScript-sublime
vendored
1
assets/syntaxes/02_Extra/GDScript-sublime
vendored
Submodule assets/syntaxes/02_Extra/GDScript-sublime deleted from 96f5dcf297
23
assets/syntaxes/02_Extra/Hosts.sublime-syntax
vendored
Normal file
23
assets/syntaxes/02_Extra/Hosts.sublime-syntax
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: hosts
|
||||
file_extensions:
|
||||
- hosts
|
||||
scope: source.hosts
|
||||
|
||||
contexts:
|
||||
main:
|
||||
- scope: comment.line.number-sign
|
||||
match: \#.*
|
||||
comment: comment
|
||||
|
||||
- match: ^\s*([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|[0-9a-f:]+)
|
||||
comment: ipaddress
|
||||
scope: constant.numeric.ipaddress
|
||||
|
||||
|
||||
- match: \s(localhost|ip6-loopback|ip6-localhost|ip6-localnet|ip6-mcastprefix|ip6-allnodes|ip6-allrouters|ip6-allhosts|broadcasthost)\b
|
||||
scope: keyword.host.predefined}
|
||||
comment: prefdfined
|
||||
|
1
assets/syntaxes/02_Extra/Idris2
vendored
1
assets/syntaxes/02_Extra/Idris2
vendored
Submodule assets/syntaxes/02_Extra/Idris2 deleted from 7c1bf44c4f
2
assets/syntaxes/02_Extra/Julia
vendored
2
assets/syntaxes/02_Extra/Julia
vendored
Submodule assets/syntaxes/02_Extra/Julia updated: 3366b10be9...98233f96d4
2
assets/syntaxes/02_Extra/Lean
vendored
2
assets/syntaxes/02_Extra/Lean
vendored
Submodule assets/syntaxes/02_Extra/Lean updated: 514362b5c7...29a03a8aba
157
assets/syntaxes/02_Extra/Lean.sublime-syntax
vendored
157
assets/syntaxes/02_Extra/Lean.sublime-syntax
vendored
@@ -1,130 +1,125 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/syntax.html
|
||||
name: Lean 4
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Lean
|
||||
file_extensions:
|
||||
- lean
|
||||
scope: source.lean4
|
||||
scope: source.lean
|
||||
contexts:
|
||||
main:
|
||||
- include: comments
|
||||
- match: \b(Prop|Type|Sort)\b
|
||||
scope: storage.type.lean4
|
||||
- match: '\battribute\b\s*\[[^\]]*\]'
|
||||
scope: storage.modifier.lean4
|
||||
- match: '@\[[^\]]*\]'
|
||||
scope: storage.modifier.lean4
|
||||
- match: \b(?<!\.)(global|local|scoped|partial|unsafe|private|protected|noncomputable)(?!\.)\b
|
||||
scope: storage.modifier.lean4
|
||||
- match: \b(sorry|admit|stop)\b
|
||||
scope: invalid.illegal.lean4
|
||||
- match: '#(print|eval|reduce|check|check_failure)\b'
|
||||
scope: keyword.other.lean4
|
||||
- match: \bderiving\s+instance\b
|
||||
scope: keyword.other.command.lean4
|
||||
- match: '\b(?<!\.)(inductive|coinductive|structure|theorem|axiom|abbrev|lemma|def|instance|class|constant)\b\s+(\{[^}]*\})?'
|
||||
- match: '\b(?<!\.)(inductive|coinductive|structure|theorem|axiom|axioms|abbreviation|lemma|definition|def|instance|class|constant)\b\s+(\{[^}]*\})?'
|
||||
captures:
|
||||
1: keyword.other.definitioncommand.lean4
|
||||
1: keyword.other.definitioncommand.lean
|
||||
push:
|
||||
- meta_scope: meta.definitioncommand.lean4
|
||||
- match: '(?=\bwith\b|\bextends\b|\bwhere\b|[:\|\(\[\{⦃<>])'
|
||||
- meta_scope: meta.definitioncommand.lean
|
||||
- match: '(?=\bwith\b|\bextends\b|[:\|\(\[\{⦃<>])'
|
||||
pop: true
|
||||
- include: comments
|
||||
- include: definitionName
|
||||
- match: ','
|
||||
- match: \b(?<!\.)(theorem|show|have|from|suffices|nomatch|def|class|structure|instance|set_option|initialize|builtin_initialize|example|inductive|coinductive|axiom|constant|universe|universes|variable|variables|import|open|export|theory|prelude|renaming|hiding|exposing|do|by|let|extends|mutual|mut|where|rec|syntax|macro_rules|macro|deriving|fun|section|namespace|end|infix|infixl|infixr|postfix|prefix|notation|abbrev|if|then|else|calc|match|with|for|in|unless|try|catch|finally|return|continue|break)(?!\.)\b
|
||||
scope: keyword.other.lean4
|
||||
- match: ","
|
||||
- match: \b(Prop|Type|Sort)\b
|
||||
scope: storage.type.lean
|
||||
- match: '\battribute\b\s*\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: '@\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: \b(?<!\.)(private|meta|mutual|protected|noncomputable)\b
|
||||
scope: keyword.control.definition.modifier.lean
|
||||
- match: \b(sorry)\b
|
||||
scope: invalid.illegal.lean
|
||||
- match: '#print\s+(def|definition|inductive|instance|structure|axiom|axioms|class)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: '#(print|eval|reduce|check|help|exit|find|where)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: \b(?<!\.)(import|export|prelude|theory|definition|def|abbreviation|instance|renaming|hiding|exposing|parameter|parameters|begin|constant|constants|lemma|variable|variables|theorem|example|open|axiom|inductive|coinductive|with|structure|universe|universes|alias|precedence|reserve|postfix|prefix|infix|infixl|infixr|notation|end|using|namespace|section|local|set_option|extends|include|omit|class|classes|instances|raw|run_cmd|restate_axiom)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: \b(?<!\.)(calc|have|this|match|do|suffices|show|by|in|at|let|forall|fun|exists|assume|from|obtain|haveI|λ)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.lean4
|
||||
- meta_content_scope: entity.name.lean
|
||||
- match: »
|
||||
pop: true
|
||||
- match: (s!)"
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
push:
|
||||
- meta_scope: string.interpolated.lean4
|
||||
- match: '"'
|
||||
pop: true
|
||||
- match: '(\{)'
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
push:
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: keyword.other.lean4
|
||||
pop: true
|
||||
- include: main
|
||||
- match: '\\[\\"ntr'']'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: \b(?<!\.)(if|then|else)\b
|
||||
scope: keyword.control.lean
|
||||
- match: '"'
|
||||
push:
|
||||
- meta_scope: string.quoted.double.lean4
|
||||
- match: '"'
|
||||
pop: true
|
||||
- match: '\\[\\"ntr'']'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean4
|
||||
- match: \b(true|false)\b
|
||||
scope: constant.language.lean4
|
||||
- match: '''[^\\'']'''
|
||||
scope: string.quoted.single.lean4
|
||||
- match: '''(\\(x[0-9A-Fa-f][0-9A-Fa-f]|u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]|.))'''
|
||||
scope: string.quoted.single.lean4
|
||||
captures:
|
||||
1: constant.character.escape.lean4
|
||||
0: punctuation.definition.string.begin.lean
|
||||
push:
|
||||
- meta_scope: string.quoted.double.lean
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.lean
|
||||
pop: true
|
||||
- match: '\\[\\"nt'']'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '''[^\\'']'''
|
||||
scope: string.quoted.single.lean
|
||||
- match: '''(\\(x..|u....|.))'''
|
||||
scope: string.quoted.single.lean
|
||||
captures:
|
||||
1: constant.character.escape.lean
|
||||
- match: '`+[^\[(]\S+'
|
||||
scope: entity.name.lean4
|
||||
- match: '\b([0-9]+|0([xX][0-9a-fA-F]+)|[-]?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?)\b'
|
||||
scope: constant.numeric.lean4
|
||||
scope: entity.name.lean
|
||||
- match: '\b([0-9]+|0([xX][0-9a-fA-F]+))\b'
|
||||
scope: constant.numeric.lean
|
||||
blockComment:
|
||||
- match: /-
|
||||
push:
|
||||
- meta_scope: comment.block.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
comments:
|
||||
- include: dashComment
|
||||
- include: docComment
|
||||
- include: stringBlock
|
||||
- include: modDocComment
|
||||
- include: blockComment
|
||||
dashComment:
|
||||
- match: '--'
|
||||
- match: (--)
|
||||
captures:
|
||||
0: punctuation.definition.comment.lean
|
||||
push:
|
||||
- meta_scope: comment.line.double-dash.lean4
|
||||
- meta_scope: comment.line.double-dash.lean
|
||||
- match: $
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
definitionName:
|
||||
- match: '\b[^:«»\(\)\{\}[:space:]=→λ∀?][^:«»\(\)\{\}[:space:]]*'
|
||||
scope: entity.name.function.lean4
|
||||
scope: entity.name.function.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.function.lean4
|
||||
- meta_content_scope: entity.name.function.lean
|
||||
- match: »
|
||||
pop: true
|
||||
docComment:
|
||||
- match: /--
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
modDocComment:
|
||||
- match: /-!
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean4
|
||||
- match: '-/'
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean4.markdown
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
stringBlock:
|
||||
- match: /-"
|
||||
push:
|
||||
- meta_scope: comment.block.string.lean
|
||||
- match: '"-/'
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
|
1
assets/syntaxes/02_Extra/LiveScript
vendored
Submodule
1
assets/syntaxes/02_Extra/LiveScript
vendored
Submodule
Submodule assets/syntaxes/02_Extra/LiveScript added at d82aeb737d
@@ -85,9 +85,6 @@ contexts:
|
||||
|
||||
options:
|
||||
# command-line options like --option=value, --some-flag, or -x
|
||||
- match: '^[ ]{7}(-)(?=\s)'
|
||||
captures:
|
||||
1: entity.name.command-line-option.man
|
||||
- match: '^[ ]{7}(?=-|\+)'
|
||||
push: expect-command-line-option
|
||||
- match: '(?:[^a-zA-Z0-9_-]|^|\s){{command_line_option}}'
|
||||
|
2
assets/syntaxes/02_Extra/Nix
vendored
2
assets/syntaxes/02_Extra/Nix
vendored
Submodule assets/syntaxes/02_Extra/Nix updated: 48c497c709...9032bd6137
1
assets/syntaxes/02_Extra/Org mode
vendored
Submodule
1
assets/syntaxes/02_Extra/Org mode
vendored
Submodule
Submodule assets/syntaxes/02_Extra/Org mode added at 4976d8f84e
1
assets/syntaxes/02_Extra/Org_mode
vendored
1
assets/syntaxes/02_Extra/Org_mode
vendored
Submodule assets/syntaxes/02_Extra/Org_mode deleted from bb6e5d8481
2
assets/syntaxes/02_Extra/PowerShell
vendored
2
assets/syntaxes/02_Extra/PowerShell
vendored
Submodule assets/syntaxes/02_Extra/PowerShell updated: a08b55bf11...c0372a1d2d
2
assets/syntaxes/02_Extra/Protobuf
vendored
2
assets/syntaxes/02_Extra/Protobuf
vendored
Submodule assets/syntaxes/02_Extra/Protobuf updated: 1365331580...726e21d74d
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
1
assets/syntaxes/02_Extra/SmartVHDL
vendored
Submodule assets/syntaxes/02_Extra/SmartVHDL deleted from b45507ddc8
2
assets/syntaxes/02_Extra/TOML
vendored
2
assets/syntaxes/02_Extra/TOML
vendored
Submodule assets/syntaxes/02_Extra/TOML updated: f5a57e8bff...fd0bf3e5d6
2
assets/syntaxes/02_Extra/Zig
vendored
2
assets/syntaxes/02_Extra/Zig
vendored
Submodule assets/syntaxes/02_Extra/Zig updated: 8a4a3fe4a0...1a4a38445f
@@ -1,42 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/syntax.html
|
||||
name: debsources
|
||||
file_extensions:
|
||||
- sources.list
|
||||
scope: text.apt-source-list
|
||||
contexts:
|
||||
main:
|
||||
- include: comments
|
||||
- match: ^[\w-]+
|
||||
scope: constant.language.apt-source-list
|
||||
- match: \w+://\S+
|
||||
scope: markup.underline.link.apt-source-list
|
||||
push: distribution
|
||||
- match: \bmain\b
|
||||
scope: support.class.apt-source-list
|
||||
- match: \buniverse\b
|
||||
scope: support.constant.apt-source-list
|
||||
- match: \brestricted\b
|
||||
scope: storage.modifier.apt-source-list
|
||||
- match: \bmultiverse\b
|
||||
scope: keyword.other.apt-source-list
|
||||
- match: '[\w-]+'
|
||||
scope: constant.other.apt-source-list
|
||||
|
||||
comments:
|
||||
- match: '#'
|
||||
scope: punctuation.definition.comment.apt-source-list
|
||||
push: line_comment
|
||||
|
||||
line_comment:
|
||||
- meta_scope: comment.line.apt-source-list
|
||||
- match: $
|
||||
pop: true
|
||||
|
||||
distribution:
|
||||
- match: \S+
|
||||
scope: support.type.apt-source-list
|
||||
pop: 1
|
||||
- match: $
|
||||
pop: 1
|
2
assets/syntaxes/02_Extra/cmd-help
vendored
2
assets/syntaxes/02_Extra/cmd-help
vendored
Submodule assets/syntaxes/02_Extra/cmd-help updated: c71ba410bd...b150d84534
2
assets/syntaxes/02_Extra/hosts
vendored
2
assets/syntaxes/02_Extra/hosts
vendored
Submodule assets/syntaxes/02_Extra/hosts updated: 60ed92c472...21250a7117
24
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
24
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
@@ -38,21 +38,21 @@ contexts:
|
||||
scope: markup.underline.link.scheme.log
|
||||
push: url-host
|
||||
log_level_lines:
|
||||
- match: (?=.*{{error}})
|
||||
- match: ^(?=.*{{error}})
|
||||
push:
|
||||
- error_line_meta
|
||||
- error_line
|
||||
- main_pop_at_eol
|
||||
- match: (?=.*{{warning}})
|
||||
- match: ^(?=.*{{warning}})
|
||||
push:
|
||||
- warning_line_meta
|
||||
- warning_line
|
||||
- main_pop_at_eol
|
||||
- match: (?=.*{{info}})
|
||||
- match: ^(?=.*{{info}})
|
||||
push:
|
||||
- info_line_meta
|
||||
- info_line
|
||||
- main_pop_at_eol
|
||||
- match: (?=.*{{debug}})
|
||||
- match: ^(?=.*{{debug}})
|
||||
push:
|
||||
- debug_line_meta
|
||||
- debug_line
|
||||
- main_pop_at_eol
|
||||
log_levels:
|
||||
- match: '{{error}}'
|
||||
@@ -63,16 +63,16 @@ contexts:
|
||||
scope: markup.info.log
|
||||
- match: '{{debug}}'
|
||||
scope: markup.info.log
|
||||
error_line_meta:
|
||||
error_line:
|
||||
- meta_scope: meta.annotation.error-line.log
|
||||
- include: immediately_pop
|
||||
warning_line_meta:
|
||||
warning_line:
|
||||
- meta_scope: meta.annotation.warning-line.log
|
||||
- include: immediately_pop
|
||||
info_line_meta:
|
||||
info_line:
|
||||
- meta_scope: meta.annotation.info-line.log
|
||||
- include: immediately_pop
|
||||
debug_line_meta:
|
||||
debug_line:
|
||||
- meta_scope: meta.annotation.debug-line.log
|
||||
- include: immediately_pop
|
||||
immediately_pop:
|
||||
|
1
assets/syntaxes/02_Extra/sublime-odin
vendored
1
assets/syntaxes/02_Extra/sublime-odin
vendored
Submodule assets/syntaxes/02_Extra/sublime-odin deleted from 5d6a0ed41e
6
assets/syntaxes/02_Extra/syntax_test_man.man
vendored
6
assets/syntaxes/02_Extra/syntax_test_man.man
vendored
@@ -131,12 +131,6 @@ OPTIONS
|
||||
# ^^ - variable
|
||||
output NUM (default 3) lines of copied context
|
||||
|
||||
- This is not really a switch, but indicates that standard input
|
||||
# ^ entity.name.command-line-option.man
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - entity - variable
|
||||
is coming from a file or a pipe and not interactively from the
|
||||
command line.
|
||||
|
||||
EXAMPLE
|
||||
#include <stdio.h>
|
||||
# ^^^^^^^^ source.c meta.preprocessor.include keyword.control.import.include
|
||||
|
36
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
36
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
@@ -8,10 +8,10 @@ scope: text.log.syslog
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
|
||||
scope: meta.datetime.syslog
|
||||
scope: meta.datetime.syslog constant.numeric.syslog
|
||||
captures:
|
||||
1: meta.date.syslog constant.numeric.syslog
|
||||
2: meta.time.syslog constant.numeric.syslog
|
||||
1: meta.date.syslog
|
||||
2: meta.time.syslog
|
||||
push: loghost
|
||||
- match: ^
|
||||
push: text
|
||||
@@ -31,24 +31,22 @@ contexts:
|
||||
structured-data:
|
||||
- match: '\['
|
||||
scope: punctuation.section.mapping.begin.syslog
|
||||
push: structured-data-contents
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.mapping.end.syslog
|
||||
pop: true
|
||||
- match: \w+
|
||||
scope: variable.parameter.syslog
|
||||
- match: =
|
||||
scope: keyword.operator.assignment.syslog
|
||||
push:
|
||||
- match: '[^\s\]]+'
|
||||
scope: constant.other.syslog
|
||||
pop: true
|
||||
- match: (?=\])
|
||||
pop: true
|
||||
- match: (?=\S)
|
||||
set: text
|
||||
structured-data-contents:
|
||||
- match: \]
|
||||
scope: punctuation.section.mapping.end.syslog
|
||||
pop: true
|
||||
- match: \w+
|
||||
scope: variable.parameter.syslog
|
||||
- match: =
|
||||
scope: keyword.operator.assignment.syslog
|
||||
push: structured-data-assignment
|
||||
structured-data-assignment:
|
||||
- match: '[^\s\]]+'
|
||||
scope: constant.other.syslog
|
||||
pop: true
|
||||
- match: (?=\])
|
||||
pop: true
|
||||
text:
|
||||
- match: $
|
||||
pop: true
|
||||
|
Submodule assets/syntaxes/02_Extra/typst-syntax-highlight deleted from 4e2e68b0a1
2
assets/theme_preview.rs
vendored
2
assets/theme_preview.rs
vendored
@@ -1,5 +1,5 @@
|
||||
// Output the square of a number.
|
||||
fn print_square(num: f64) {
|
||||
let result = f64::powf(num, 2.0);
|
||||
println!("The square of {num:.2} is {result:.2}.");
|
||||
println!("The square of {:.2} is {:.2}.", num, result);
|
||||
}
|
||||
|
BIN
assets/themes.bin
vendored
BIN
assets/themes.bin
vendored
Binary file not shown.
1
assets/themes/Catppuccin
vendored
1
assets/themes/Catppuccin
vendored
Submodule assets/themes/Catppuccin deleted from ccf194fdc9
2
assets/themes/Nord-sublime
vendored
2
assets/themes/Nord-sublime
vendored
Submodule assets/themes/Nord-sublime updated: bf92a9e445...0d655b23d6
6
assets/themes/ansi.tmTheme
vendored
6
assets/themes/ansi.tmTheme
vendored
@@ -69,7 +69,7 @@
|
||||
<key>name</key>
|
||||
<string>Labels</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.label, variable.parameter</string>
|
||||
<string>entity.name.label</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -80,7 +80,7 @@
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>support.class, entity.name.class, entity.name.type.class, entity.name</string>
|
||||
<string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -234,7 +234,7 @@
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
|
4
assets/themes/base16-256.tmTheme
vendored
4
assets/themes/base16-256.tmTheme
vendored
@@ -257,7 +257,7 @@
|
||||
<key>name</key>
|
||||
<string>Tags</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag, entity.name</string>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -312,7 +312,7 @@
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
|
4
assets/themes/base16.tmTheme
vendored
4
assets/themes/base16.tmTheme
vendored
@@ -256,7 +256,7 @@
|
||||
<key>name</key>
|
||||
<string>Tags</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag, entity.name</string>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -311,7 +311,7 @@
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown</string>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
|
2
assets/themes/github-sublime-theme
vendored
2
assets/themes/github-sublime-theme
vendored
Submodule assets/themes/github-sublime-theme updated: 59e525f638...508740b243
2
assets/themes/gruvbox
vendored
2
assets/themes/gruvbox
vendored
Submodule assets/themes/gruvbox updated: 4050347282...64c47250e5
2
assets/themes/sublime-snazzy
vendored
2
assets/themes/sublime-snazzy
vendored
Submodule assets/themes/sublime-snazzy updated: 48f43a7350...70343201f1
2
assets/themes/zenburn
vendored
2
assets/themes/zenburn
vendored
Submodule assets/themes/zenburn updated: 4f21745723...e627f1cb22
@@ -63,22 +63,5 @@ pub fn gen_man_and_comp() -> anyhow::Result<()> {
|
||||
out_dir.join("assets/completions/bat.zsh"),
|
||||
)?;
|
||||
|
||||
println!(
|
||||
"cargo:rustc-env=BAT_GENERATED_COMPLETION_BASH={}",
|
||||
out_dir.join("assets/completions/bat.bash").display()
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=BAT_GENERATED_COMPLETION_FISH={}",
|
||||
out_dir.join("assets/completions/bat.fish").display()
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=BAT_GENERATED_COMPLETION_PS1={}",
|
||||
out_dir.join("assets/completions/_bat.ps1").display()
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=BAT_GENERATED_COMPLETION_ZSH={}",
|
||||
out_dir.join("assets/completions/bat.zsh").display()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#[cfg(feature = "application")]
|
||||
mod application;
|
||||
mod syntax_mapping;
|
||||
mod util;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
@@ -8,8 +7,6 @@ fn main() -> anyhow::Result<()> {
|
||||
// see: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed
|
||||
println!("cargo:rerun-if-changed=build/");
|
||||
|
||||
syntax_mapping::build_static_mappings()?;
|
||||
|
||||
#[cfg(feature = "application")]
|
||||
application::gen_man_and_comp()?;
|
||||
|
||||
|
@@ -1,303 +0,0 @@
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
env, fs,
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, bail};
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
use once_cell::sync::Lazy;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, ToTokens, TokenStreamExt};
|
||||
use regex::Regex;
|
||||
use serde_derive::Deserialize;
|
||||
use serde_with::DeserializeFromStr;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
/// Known mapping targets.
|
||||
///
|
||||
/// Corresponds to `syntax_mapping::MappingTarget`.
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, DeserializeFromStr)]
|
||||
pub enum MappingTarget {
|
||||
MapTo(String),
|
||||
MapToUnknown,
|
||||
MapExtensionToUnknown,
|
||||
}
|
||||
impl FromStr for MappingTarget {
|
||||
type Err = Infallible;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"MappingTarget::MapToUnknown" => Ok(Self::MapToUnknown),
|
||||
"MappingTarget::MapExtensionToUnknown" => Ok(Self::MapExtensionToUnknown),
|
||||
syntax => Ok(Self::MapTo(syntax.into())),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ToTokens for MappingTarget {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self {
|
||||
Self::MapTo(syntax) => quote! { MappingTarget::MapTo(#syntax) },
|
||||
Self::MapToUnknown => quote! { MappingTarget::MapToUnknown },
|
||||
Self::MapExtensionToUnknown => quote! { MappingTarget::MapExtensionToUnknown },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, DeserializeFromStr)]
|
||||
/// A single matcher.
|
||||
///
|
||||
/// Codegen converts this into a `Lazy<Option<GlobMatcher>>`.
|
||||
struct Matcher(Vec<MatcherSegment>);
|
||||
/// Parse a matcher.
|
||||
///
|
||||
/// Note that this implementation is rather strict: it will greedily interpret
|
||||
/// every valid environment variable replacement as such, then immediately
|
||||
/// hard-error if it finds a '$' anywhere in the remaining text segments.
|
||||
///
|
||||
/// The reason for this strictness is I currently cannot think of a valid reason
|
||||
/// why you would ever need '$' as plaintext in a glob pattern. Therefore any
|
||||
/// such occurrences are likely human errors.
|
||||
///
|
||||
/// If we later discover some edge cases, it's okay to make it more permissive.
|
||||
///
|
||||
/// Revision history:
|
||||
/// - 2024-02-20: allow `{` and `}` (glob brace expansion)
|
||||
impl FromStr for Matcher {
|
||||
type Err = anyhow::Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
use MatcherSegment as Seg;
|
||||
static VAR_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\$\{([\w\d_]+)\}").unwrap());
|
||||
|
||||
let mut segments = vec![];
|
||||
let mut text_start = 0;
|
||||
for capture in VAR_REGEX.captures_iter(s) {
|
||||
let match_0 = capture.get(0).unwrap();
|
||||
|
||||
// text before this var
|
||||
let text_end = match_0.start();
|
||||
segments.push(Seg::Text(s[text_start..text_end].into()));
|
||||
text_start = match_0.end();
|
||||
|
||||
// this var
|
||||
segments.push(Seg::Env(capture.get(1).unwrap().as_str().into()));
|
||||
}
|
||||
// possible trailing text
|
||||
segments.push(Seg::Text(s[text_start..].into()));
|
||||
|
||||
// cleanup empty text segments
|
||||
let non_empty_segments = segments
|
||||
.into_iter()
|
||||
.filter(|seg| seg.text().map(|t| !t.is_empty()).unwrap_or(true))
|
||||
.collect_vec();
|
||||
|
||||
// sanity check
|
||||
if non_empty_segments
|
||||
.windows(2)
|
||||
.any(|segs| segs[0].is_text() && segs[1].is_text())
|
||||
{
|
||||
unreachable!("Parsed into consecutive text segments: {non_empty_segments:?}");
|
||||
}
|
||||
|
||||
// guard empty case
|
||||
if non_empty_segments.is_empty() {
|
||||
bail!(r#"Parsed an empty matcher: "{s}""#);
|
||||
}
|
||||
|
||||
// guard variable syntax leftover fragments
|
||||
if non_empty_segments
|
||||
.iter()
|
||||
.filter_map(Seg::text)
|
||||
.any(|t| t.contains('$'))
|
||||
{
|
||||
bail!(r#"Invalid matcher: "{s}""#);
|
||||
}
|
||||
|
||||
Ok(Self(non_empty_segments))
|
||||
}
|
||||
}
|
||||
impl ToTokens for Matcher {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self.0.as_slice() {
|
||||
[] => unreachable!("0-length matcher should never be created"),
|
||||
[MatcherSegment::Text(text)] => {
|
||||
quote! { Lazy::new(|| Some(build_matcher_fixed(#text))) }
|
||||
}
|
||||
// parser logic ensures that this case can only happen when there are dynamic segments
|
||||
segs @ [_, ..] => quote! { Lazy::new(|| build_matcher_dynamic(&[ #(#segs),* ])) },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
}
|
||||
}
|
||||
|
||||
/// A segment in a matcher.
|
||||
///
|
||||
/// Corresponds to `syntax_mapping::MatcherSegment`.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
enum MatcherSegment {
|
||||
Text(String),
|
||||
Env(String),
|
||||
}
|
||||
impl ToTokens for MatcherSegment {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let t = match self {
|
||||
Self::Text(text) => quote! { MatcherSegment::Text(#text) },
|
||||
Self::Env(env) => quote! { MatcherSegment::Env(#env) },
|
||||
};
|
||||
tokens.append_all(t);
|
||||
}
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
impl MatcherSegment {
|
||||
fn is_text(&self) -> bool {
|
||||
matches!(self, Self::Text(_))
|
||||
}
|
||||
fn is_env(&self) -> bool {
|
||||
matches!(self, Self::Env(_))
|
||||
}
|
||||
fn text(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::Text(t) => Some(t),
|
||||
Self::Env(_) => None,
|
||||
}
|
||||
}
|
||||
fn env(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::Text(_) => None,
|
||||
Self::Env(t) => Some(t),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct that models a single .toml file in /src/syntax_mapping/builtins/.
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
struct MappingDefModel {
|
||||
mappings: IndexMap<MappingTarget, Vec<Matcher>>,
|
||||
}
|
||||
impl MappingDefModel {
|
||||
fn into_mapping_list(self) -> MappingList {
|
||||
let list = self
|
||||
.mappings
|
||||
.into_iter()
|
||||
.flat_map(|(target, matchers)| {
|
||||
matchers
|
||||
.into_iter()
|
||||
.map(|matcher| (matcher, target.clone()))
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.collect();
|
||||
MappingList(list)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct MappingList(Vec<(Matcher, MappingTarget)>);
|
||||
impl ToTokens for MappingList {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let len = self.0.len();
|
||||
let array_items = self
|
||||
.0
|
||||
.iter()
|
||||
.map(|(matcher, target)| quote! { (#matcher, #target) });
|
||||
|
||||
let t = quote! {
|
||||
/// Generated by build script from /src/syntax_mapping/builtins/.
|
||||
pub(crate) static BUILTIN_MAPPINGS: [(Lazy<Option<GlobMatcher>>, MappingTarget); #len] = [#(#array_items),*];
|
||||
};
|
||||
tokens.append_all(t);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the list of paths to all mapping definition files that should be
|
||||
/// included for the current target platform.
|
||||
fn get_def_paths() -> anyhow::Result<Vec<PathBuf>> {
|
||||
let source_subdirs = [
|
||||
"common",
|
||||
#[cfg(target_family = "unix")]
|
||||
"unix-family",
|
||||
#[cfg(any(
|
||||
target_os = "freebsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "macos"
|
||||
))]
|
||||
"bsd-family",
|
||||
#[cfg(target_os = "linux")]
|
||||
"linux",
|
||||
#[cfg(target_os = "macos")]
|
||||
"macos",
|
||||
#[cfg(target_os = "windows")]
|
||||
"windows",
|
||||
];
|
||||
|
||||
let mut toml_paths = vec![];
|
||||
for subdir_name in source_subdirs {
|
||||
let subdir = Path::new("src/syntax_mapping/builtins").join(subdir_name);
|
||||
if !subdir.try_exists()? {
|
||||
// Directory might not exist due to this `cargo vendor` bug:
|
||||
// https://github.com/rust-lang/cargo/issues/15080
|
||||
continue;
|
||||
}
|
||||
let wd = WalkDir::new(subdir);
|
||||
let paths = wd
|
||||
.into_iter()
|
||||
.filter_map_ok(|entry| {
|
||||
let path = entry.path();
|
||||
(path.is_file() && path.extension().map(|ext| ext == "toml").unwrap_or(false))
|
||||
.then(|| path.to_owned())
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
toml_paths.extend(paths);
|
||||
}
|
||||
|
||||
toml_paths.sort_by_key(|path| {
|
||||
path.file_name()
|
||||
.expect("file name should not terminate in ..")
|
||||
.to_owned()
|
||||
});
|
||||
|
||||
Ok(toml_paths)
|
||||
}
|
||||
|
||||
fn read_all_mappings() -> anyhow::Result<MappingList> {
|
||||
let mut all_mappings = vec![];
|
||||
|
||||
for path in get_def_paths()? {
|
||||
let toml_string = fs::read_to_string(path)?;
|
||||
let mappings = toml::from_str::<MappingDefModel>(&toml_string)?.into_mapping_list();
|
||||
all_mappings.extend(mappings.0);
|
||||
}
|
||||
|
||||
let duplicates = all_mappings
|
||||
.iter()
|
||||
.duplicates_by(|(matcher, _)| matcher)
|
||||
.collect_vec();
|
||||
if !duplicates.is_empty() {
|
||||
bail!("Rules with duplicate matchers found: {duplicates:?}");
|
||||
}
|
||||
|
||||
Ok(MappingList(all_mappings))
|
||||
}
|
||||
|
||||
/// Build the static syntax mappings defined in /src/syntax_mapping/builtins/
|
||||
/// into a .rs source file, which is to be inserted with `include!`.
|
||||
pub fn build_static_mappings() -> anyhow::Result<()> {
|
||||
println!("cargo:rerun-if-changed=src/syntax_mapping/builtins/");
|
||||
|
||||
let mappings = read_all_mappings()?;
|
||||
|
||||
// IMPRV: parse + unparse is a bit cringe, but there seems to be no better
|
||||
// option given the limited APIs of `prettyplease`
|
||||
let rs_src = syn::parse_file(&mappings.to_token_stream().to_string())?;
|
||||
let rs_src_pretty = prettyplease::unparse(&rs_src);
|
||||
|
||||
let codegen_path = Path::new(&env::var_os("OUT_DIR").ok_or(anyhow!("OUT_DIR is unset"))?)
|
||||
.join("codegen_static_syntax_mappings.rs");
|
||||
|
||||
fs::write(codegen_path, rs_src_pretty)?;
|
||||
|
||||
Ok(())
|
||||
}
|
@@ -366,7 +366,7 @@ ansible-galaxy install aeimer.install_bat
|
||||
### From source
|
||||
|
||||
|
||||
`bat` をソースからビルドしたいならば、Rust 1.74.0 以上の環境が必要です。
|
||||
`bat` をソースからビルドしたいならば、Rust 1.70.0 以上の環境が必要です。
|
||||
`cargo` を使用してビルドすることができます:
|
||||
|
||||
```bash
|
||||
|
@@ -163,7 +163,7 @@ git show v0.6.0:src/main.rs | bat -l rs
|
||||
볼 수 있습니다:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --relative --diff-filter=d -z | xargs -0 bat --diff
|
||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
이것을 별도의 도구로 쓰고 싶다면
|
||||
@@ -416,7 +416,7 @@ scoop install bat
|
||||
|
||||
### 소스에서
|
||||
|
||||
`bat`의 소스를 빌드하기 위해서는, Rust 1.74.0 이상이 필요합니다.
|
||||
`bat`의 소스를 빌드하기 위해서는, Rust 1.70.0 이상이 필요합니다.
|
||||
`cargo`를 이용해 전부 빌드할 수 있습니다:
|
||||
|
||||
```bash
|
||||
@@ -461,11 +461,11 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
|
||||
- `ansi`는 어떤 터미널에서도 무난하게 보입니다. 이는 3비트 색상을 사용합니다:
|
||||
검정, 빨강, 녹색, 노랑, 파랑, 마젠타, 시안, 하양.
|
||||
- `base16`은 [base16](https://github.com/tinted-theming/home) 터미널 테마를 위해
|
||||
- `base16`은 [base16](https://github.com/chriskempson/base16) 터미널 테마를 위해
|
||||
디자인되었습니다.
|
||||
이는 [base16 스타일 가이드라인](https://github.com/tinted-theming/home/blob/main/styling.md)에
|
||||
이는 [base16 스타일 가이드라인](https://github.com/chriskempson/base16/blob/master/styling.md)에
|
||||
따라 4비트 색상(3비트 색상에 밝은 변형 추가)을 사용합니다.
|
||||
- `base16-256`는 [base16-shell](https://github.com/tinted-theming/base16-shell)을
|
||||
- `base16-256`는 [base16-shell](https://github.com/chriskempson/base16-shell)을
|
||||
위해 디자인되었습니다.
|
||||
이는 16부터 21의 일부 밝은 색상을 8비트 색상으로 대치합니다.
|
||||
단지 256-색상 터미널을 쓰지만 base16-shell을 쓰지 않는다고 해서 이것을
|
||||
|
179
doc/README-ru.md
179
doc/README-ru.md
@@ -3,11 +3,11 @@
|
||||
<a href="https://github.com/sharkdp/bat/actions?query=workflow%3ACICD"><img src="https://github.com/sharkdp/bat/workflows/CICD/badge.svg" alt="Build Status"></a>
|
||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||
Клон утилиты <i>cat(1)</i> с поддержкой подсветки синтаксиса и Git
|
||||
Клон утилиты <i>cat(1)</i> с поддержкой выделения синтаксиса и Git
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#подсветка-синтаксиса">Ключевые возможности</a> •
|
||||
<a href="#выделение-синтаксиса">Ключевые возможности</a> •
|
||||
<a href="#как-использовать">Использование</a> •
|
||||
<a href="#установка">Установка</a> •
|
||||
<a href="#кастомизация">Кастомизация</a> •
|
||||
@@ -19,11 +19,11 @@
|
||||
[Русский]
|
||||
</p>
|
||||
|
||||
### Подсветка синтаксиса
|
||||
### Выделение синтаксиса
|
||||
|
||||
`bat` поддерживает подсветку синтаксиса для огромного количества языков программирования и разметки:
|
||||
`bat` поддерживает выделение синтаксиса для огромного количества языков программирования и разметки:
|
||||
|
||||

|
||||

|
||||
|
||||
### Интеграция с Git
|
||||
`bat` использует `git`, чтобы показать изменения в коде
|
||||
@@ -31,17 +31,15 @@
|
||||
|
||||

|
||||
|
||||
### Показ непечатных символов
|
||||
### Показать непечатаемые символы
|
||||
|
||||
Вы можете использовать флаг `-A` / `--show-all`, чтобы показать непечатные символы:
|
||||
Вы можете использовать `-A` / `--show-all` флаг, чтобы показать символы, которые невозможно напечатать:
|
||||
|
||||

|
||||
|
||||
### Автоматический пейджинг терминала
|
||||
### Автоматическое разделение текста
|
||||
|
||||
`bat` умеет перенаправлять вывод в пейджер терминала (например, в `less`), если вывод не помещается на экране полностью.
|
||||
Если вы хотите, чтобы `bat` работал как `cat` всё время, вы можете установить опцию `--paging=never` в командной строке или в конфигурационном файле.
|
||||
Если вы намерены использовать `bat` в качестве алиаса для `cat`, вы можете установить `alias cat='bat --paging=never'`, чтобы сохранить изначальное поведение.
|
||||
`bat` умеет перенаправлять вывод в `less`, если вывод не помещается на экране полностью.
|
||||
|
||||
### Объединение файлов
|
||||
|
||||
@@ -88,23 +86,11 @@ bat header.md content.md footer.md > document.md
|
||||
|
||||
bat -n main.rs # показываем только количество строк
|
||||
|
||||
bat f - g # выводит 'f', потом stdin, а потом 'g'.
|
||||
bat f - g # выводит 'f' в stdin, а потом 'g'.
|
||||
```
|
||||
|
||||
### Интеграция с другими утилитами
|
||||
|
||||
#### `fzf`
|
||||
|
||||
Вы можете использовать `bat` как просмотрщик для [`fzf`](https://github.com/junegunn/fzf).
|
||||
Чтобы это заработало, используйте опцию `--color=always`, чтобы вывод был всегда цветным.
|
||||
Вы можете также использовать опцию `--line-range`, чтобы уменьшить время загрузки для больших файлов:
|
||||
|
||||
```bash
|
||||
fzf --preview "bat --color=always --style=numbers --line-range=:500 {}"
|
||||
```
|
||||
|
||||
Больше деталей смотрите в [`README` программы `fzf`](https://github.com/junegunn/fzf#preview-window).
|
||||
|
||||
#### `find` или `fd`
|
||||
|
||||
Вы можете использовать флаг `-exec` в `find`, чтобы посмотреть превью всех файлов в `bat`
|
||||
@@ -135,22 +121,12 @@ tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||
|
||||
#### `git`
|
||||
|
||||
Вы можете использовать `bat` с `git show`, чтобы просмотреть старую версию файла с подсветкой синтаксиса:
|
||||
Вы можете использовать `bat` с `git show`, чтобы просмотреть старую версию файла с выделением синтаксиса:
|
||||
```bash
|
||||
git show v0.6.0:src/main.rs | bat -l rs
|
||||
```
|
||||
|
||||
#### `git diff`
|
||||
|
||||
Вы можете использовать `bat` с `git diff` для просмотра строк кода вокруг изменений с подсветкой синтаксиса:
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --relative --diff-filter=d -z | xargs -0 bat --diff
|
||||
}
|
||||
```
|
||||
Если вы хотите использовать это как отдельную программу, посмотрите `batdiff` из [`bat-extras`](https://github.com/eth-p/bat-extras).
|
||||
|
||||
Если вам это нужна более полная поддержка для операций с git и diff, посмотрите [`delta`](https://github.com/dandavison/delta).
|
||||
Обратите внимание, что выделение синтаксиса не работает в `git diff` на данный момент. Если вам это нужно, посмотрите [`delta`](https://github.com/dandavison/delta).
|
||||
|
||||
#### `xclip`
|
||||
|
||||
@@ -159,18 +135,17 @@ batdiff() {
|
||||
```bash
|
||||
bat main.cpp | xclip
|
||||
```
|
||||
`bat` обнаружит перенаправление вывода и выведет обычный текст без подсветки синтаксиса.
|
||||
`bat` обнаружит перенаправление вывода и выведет обычный текст без выделения синтаксиса.
|
||||
|
||||
#### `man`
|
||||
|
||||
`bat` может быть использован для раскрашивания вывода `man`, для этого установите переменную окружения
|
||||
`bat` может быть использован в виде выделения цвета для `man`, для этого установите переменную окружения
|
||||
`MANPAGER`:
|
||||
|
||||
```bash
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
(замените `bat` на `batcat`, если у вас Debian или Ubuntu)
|
||||
|
||||
Возможно вам понадобится также установить `MANROFFOPT="-c"`, если у вас есть проблемы с форматированием.
|
||||
|
||||
@@ -178,40 +153,10 @@ man 2 select
|
||||
|
||||
Обратите внимание, что [синтаксис manpage](assets/syntaxes/02_Extra/Manpage.sublime-syntax) разрабатывается в этом репозитории и все еще находится в разработке.
|
||||
|
||||
Также заметьте, что это [не заработает](https://github.com/sharkdp/bat/issues/1145) с реализацией `man` через Mandocs.
|
||||
|
||||
#### `prettier` / `shfmt` / `rustfmt`
|
||||
|
||||
[`Prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) — скрипт, который форматирует код и выводит его с помощью `bat`.
|
||||
|
||||
#### Подсветка сообщений `--help`
|
||||
|
||||
Вы можете использовать `bat`, чтобы подсвечивать текст справки комманд: `$ cp --help | bat -plhelp`
|
||||
|
||||
Вы можете сделать такую вспомогательную команду для этого:
|
||||
|
||||
```bash
|
||||
# in your .bashrc/.zshrc/*rc
|
||||
alias bathelp='bat --plain --language=help'
|
||||
help() {
|
||||
"$@" --help 2>&1 | bathelp
|
||||
}
|
||||
```
|
||||
|
||||
В этом случае, вы можете просто писать `$ help cp` или `$ help git commit`.
|
||||
|
||||
Если вы используете `zsh`, вы можете объявить глобальные алиасы для `-h` и `--help`:
|
||||
|
||||
```bash
|
||||
alias -g -- -h='-h 2>&1 | bat --language=help --style=plain'
|
||||
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain'
|
||||
```
|
||||
|
||||
В этом случае, вы можете продолжать использовать `cp --help`, но при этом получать подцвеченный вывод.
|
||||
|
||||
Обратите внимание, что не всегда опция `-h` является краткой формы опции `--help` (например, у `ls`).
|
||||
|
||||
Пожалуйста, сообщайте о проблемах с подсветкой справки в [этот репозиторий](https://github.com/victor-gp/cmd-help-sublime-syntax).
|
||||
|
||||
## Установка
|
||||
|
||||
@@ -220,7 +165,8 @@ alias -g -- --help='--help 2>&1 | bat --language=help --style=plain'
|
||||
### Ubuntu (с помощью `apt`)
|
||||
*... и другие дистрибутивы основанные на Debian.*
|
||||
|
||||
`bat` доступен на [Ubuntu since 20.04 ("Focal")](https://packages.ubuntu.com/search?keywords=bat&exact=1) и [Debian since August 2021 (Debian 11 - "Bullseye")](https://packages.debian.org/bullseye/bat).
|
||||
`bat` есть в репозиториях [Ubuntu](https://packages.ubuntu.com/eoan/bat) и
|
||||
[Debian](https://packages.debian.org/sid/bat) и доступен начиная с Ubuntu Eoan 19.10. На Debian `bat` пока что доступен только с нестабильной веткой "Sid".
|
||||
|
||||
Если ваша версия Ubuntu/Debian достаточно новая, вы можете установить `bat` так:
|
||||
|
||||
@@ -299,14 +245,6 @@ cd /usr/ports/textproc/bat
|
||||
make install
|
||||
```
|
||||
|
||||
### On OpenBSD
|
||||
|
||||
Вы можете установить `bat` с помощью [`pkg_add(1)`](https://man.openbsd.org/pkg_add.1):
|
||||
|
||||
```bash
|
||||
pkg_add bat
|
||||
```
|
||||
|
||||
### С помощью nix
|
||||
|
||||
Вы можете установить `bat`, используя [nix package manager](https://nixos.org/nix):
|
||||
@@ -315,14 +253,6 @@ pkg_add bat
|
||||
nix-env -i bat
|
||||
```
|
||||
|
||||
### Через flox
|
||||
|
||||
Вы можете установить `bat` используя [Flox](https://flox.dev)
|
||||
|
||||
```bash
|
||||
flox install bat
|
||||
```
|
||||
|
||||
### openSUSE
|
||||
|
||||
Вы можете установить `bat` с помощью `zypper`:
|
||||
@@ -331,7 +261,7 @@ flox install bat
|
||||
zypper install bat
|
||||
```
|
||||
|
||||
### На macOS (или Linux) через Homebrew
|
||||
### macOS
|
||||
|
||||
Вы можете установить `bat` с помощью [Homebrew](http://braumeister.org/formula/bat):
|
||||
|
||||
@@ -339,8 +269,6 @@ zypper install bat
|
||||
brew install bat
|
||||
```
|
||||
|
||||
### На macOS через MacPorts
|
||||
|
||||
Или же установить его с помощью [MacPorts](https://ports.macports.org/port/bat/summary):
|
||||
|
||||
```bash
|
||||
@@ -349,19 +277,7 @@ port install bat
|
||||
|
||||
### Windows
|
||||
|
||||
Есть несколько способов установить `bat`. Как только вы установили его, посмотрите на секцию ["Использование `bat` в Windows"](#использование-bat-в-windows).
|
||||
|
||||
#### Пререквитизы
|
||||
|
||||
Вам нужно установить пакет [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
|
||||
|
||||
#### С помощью WinGet
|
||||
|
||||
Вы можете установить `bat` через [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget):
|
||||
|
||||
```bash
|
||||
winget install sharkdp.bat
|
||||
```
|
||||
Есть несколько способов установить `bat`. Как только вы установили его, посмотрите на секцию ["Использование `bat` в Windows"](#using-bat-on-windows).
|
||||
|
||||
#### С помощью Chocolatey
|
||||
|
||||
@@ -377,10 +293,50 @@ choco install bat
|
||||
scoop install bat
|
||||
```
|
||||
|
||||
Для этого у вас должен быть установлен [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
|
||||
|
||||
#### Из заранее скомпилированных файлов:
|
||||
|
||||
Их вы можете скачать на [странице релизов](https://github.com/sharkdp/bat/releases).
|
||||
|
||||
Для этого у вас должен быть установлен [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads).
|
||||
|
||||
### С помощью Docker
|
||||
|
||||
Вы можете использовать [Docker image](https://hub.docker.com/r/danlynn/bat/), чтобы запустить `bat` в контейнере:
|
||||
```bash
|
||||
docker pull danlynn/bat
|
||||
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
||||
```
|
||||
|
||||
### С помощью Ansible
|
||||
|
||||
Вы можете установить `bat` с [Ansible](https://www.ansible.com/):
|
||||
|
||||
```bash
|
||||
# Устанавливаем роль на устройстве
|
||||
ansible-galaxy install aeimer.install_bat
|
||||
```
|
||||
|
||||
```yaml
|
||||
---
|
||||
# Playbook для установки bat
|
||||
- host: all
|
||||
roles:
|
||||
- aeimer.install_bat
|
||||
```
|
||||
|
||||
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
||||
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
||||
|
||||
Этот способ должен сработать со следующими дистрибутивами:
|
||||
- Debian/Ubuntu
|
||||
- ARM (например Raspberry PI)
|
||||
- Arch Linux
|
||||
- Void Linux
|
||||
- FreeBSD
|
||||
- macOS
|
||||
|
||||
### Из скомпилированных файлов
|
||||
|
||||
Перейдите на [страницу релизов](https://github.com/sharkdp/bat/releases) для
|
||||
@@ -388,24 +344,15 @@ scoop install bat
|
||||
|
||||
### Из исходников
|
||||
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.74.0 или выше. После этого используйте `cargo`, чтобы всё скомпилировать:
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.70.0 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
Заметьте, что дополнительные файлы, такие как документация man и подсказки командной строки, не могут быть установлены таким способом.
|
||||
Они будут сгенерированы командой `cargo` должны быть доступны в папке сборки (в `build`).
|
||||
|
||||
Подсказки командной строки также доступны при таком запуске:
|
||||
```bash
|
||||
bat --completion <shell>
|
||||
# see --help for supported shells
|
||||
```
|
||||
|
||||
## Кастомизация
|
||||
|
||||
### Темы для подсветки синтаксиса
|
||||
### Темы для выделения текста
|
||||
|
||||
Используйте `bat --list-themes`, чтобы вывести список всех доступных тем. Для выбора темы `TwoDark` используйте `bat` с флагом
|
||||
`--theme=TwoDark` или выставьте переменную окружения `BAT_THEME` в `TwoDark`. Используйте `export BAT_THEME="TwoDark"` в конфигурационном файле вашей оболочки, чтобы изменить ее навсегда. Или же используйте [конфигурационный файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
|
||||
@@ -425,7 +372,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /путь/к/ф
|
||||
|
||||
### Добавление новых синтаксисов
|
||||
|
||||
`bat` использует [`syntect`](https://github.com/trishume/syntect/) для подсветки синтаксиса. `syntect` может читать
|
||||
`bat` использует [`syntect`](https://github.com/trishume/syntect/) для выделения синтаксиса. `syntect` может читать
|
||||
[файл `.sublime-syntax`](https://www.sublimetext.com/docs/3/syntax.html)
|
||||
и темы. Чтобы добавить новый синтаксис, сделайте следующее:
|
||||
|
||||
@@ -456,7 +403,7 @@ bat cache --clear
|
||||
|
||||
### Добавление новых тем
|
||||
|
||||
Это работает похожим образом, так же как и добавление новых тем подсветки синтаксиса
|
||||
Это работает похожим образом, так же как и добавление новых тем выделения синтаксиса
|
||||
|
||||
Во-первых, создайте каталог с новыми темами для синтаксиса:
|
||||
```bash
|
||||
@@ -643,7 +590,7 @@ cargo install --locked --force
|
||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||
|
||||
## Лицензия
|
||||
Copyright (c) 2018-2024 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` распространяется под лицензиями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||
|
||||
|
@@ -150,7 +150,7 @@ git show v0.6.0:src/main.rs | bat -l rs
|
||||
|
||||
```bash
|
||||
batdiff() {
|
||||
git diff --name-only --relative --diff-filter=d -z | xargs -0 bat --diff
|
||||
git diff --name-only --diff-filter=d | xargs bat --diff
|
||||
}
|
||||
```
|
||||
|
||||
@@ -170,23 +170,20 @@ bat main.cpp | xclip
|
||||
|
||||
#### `man`
|
||||
|
||||
`bat` 可以通过设置 `MANPAGER` 环境变量,用作 `man` 的彩色分页器:
|
||||
`bat`也能给`man`的输出上色。这需要设置`MANPAGER`环境变量:
|
||||
|
||||
```bash
|
||||
export MANPAGER="sh -c 'awk '\''{ gsub(/\x1B\[[0-9;]*m/, \"\", \$0); gsub(/.\x08/, \"\", \$0); print }'\'' | bat -p -lman'"
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
|
||||
(如果你使用 Debian 或 Ubuntu,请将 `batcat` 替换为 `bat`)
|
||||
(如果你使用的是 Debian 或者 Ubuntu,使用`batcat`替换`bat`)
|
||||
|
||||
如果你希望将其打包为一个新的命令,也可以使用 [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md)。
|
||||
如果你遇到格式化问题,设置`MANROFFOPT="-c"`也许会有帮助。
|
||||
|
||||
> [!WARNING]
|
||||
> 在使用 Mandoc 的 `man` 实现时,这[无法](https://github.com/sharkdp/bat/issues/1145)直接工作。
|
||||
>
|
||||
> 请使用 `batman`,或将此 Shell 脚本包装为 [Shebang 可执行文件](https://en.wikipedia.org/wiki/Shebang_(Unix)),并将 `MANPAGER` 指向该文件。
|
||||
`batman`能提供类似功能——作为一个独立的命令。
|
||||
|
||||
注意,[Manpage 语法](assets/syntaxes/02_Extra/Manpage.sublime-syntax)是在此仓库中开发的,仍需一些改进。
|
||||
注意:[man page 语法](assets/syntaxes/02_Extra/Manpage.sublime-syntax) 还需要完善。在使用特定的`man`实现时该功能[无法正常工作](https://github.com/sharkdp/bat/issues/1145)。
|
||||
|
||||
#### `prettier` / `shfmt` / `rustfmt`
|
||||
|
||||
@@ -375,7 +372,7 @@ scoop install bat
|
||||
|
||||
### 从源码编译
|
||||
|
||||
如果你想要自己构建`bat`,那么你需要安装有高于1.74.0版本的 Rust。
|
||||
如果你想要自己构建`bat`,那么你需要安装有高于1.70.0版本的 Rust。
|
||||
|
||||
使用以下命令编译。
|
||||
|
||||
@@ -404,8 +401,8 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
`bat` 自带三个 [8-bit 色彩](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 主题:
|
||||
|
||||
- `ansi` 适应于大部分终端。它使用 3-bit 色彩:黑红绿黄蓝洋红靛青白。
|
||||
- `base16`专为 [base16](https://github.com/tinted-theming/home) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/tinted-theming/home/blob/main/styling.md) 制作。
|
||||
- `base16-25`专为 [base16-shell](https://github.com/tinted-theming/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
||||
- `base16`专为 [base16](https://github.com/chriskempson/base16) 终端设计。它使用 4-bit 色彩(带有亮度的 3-bit 色彩)。根据 [base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md) 制作。
|
||||
- `base16-25`专为 [base16-shell](https://github.com/chriskempson/base16-shell) 设计。它把部分亮色替换为 8-bit 色彩。请不要直接使用该主题,除非你清楚你的256色终端是否使用 base16-shell。
|
||||
|
||||
尽管这些主题具有诸多限制,但具有一些 truecolor 主题不具有的三个优点:
|
||||
|
||||
@@ -415,7 +412,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
|
||||
### 输出样式
|
||||
|
||||
你可以用`--style`参数来控制`bat`输出的样式。使用`--style=numbers,changes`可以只开启 Git 修改和行号显示而不添加其他内容。`BAT_STYLE`环境变量具有相同功能。
|
||||
你可以用`--style`参数来控制`bat`输出的样式。使用`--style=numbers,chanegs`可以只开启 Git 修改和行号显示而不添加其他内容。`BAT_STYLE`环境变量具有相同功能。
|
||||
|
||||
### 添加新的语言和语法
|
||||
|
||||
@@ -619,59 +616,63 @@ iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||
|
||||
注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
|
||||
|
||||
## 开发
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# 递归 clone 以获取所有子模块
|
||||
# Recursive clone to retrieve all submodules
|
||||
git clone --recursive https://github.com/sharkdp/bat
|
||||
|
||||
# 构建(调试版本)
|
||||
# Build (debug version)
|
||||
cd bat
|
||||
cargo build --bins
|
||||
|
||||
# 运行单元测试和集成测试
|
||||
# Run unit tests and integration tests
|
||||
cargo test
|
||||
|
||||
# 安装(发布版本)
|
||||
# Install (release version)
|
||||
cargo install --path . --locked
|
||||
|
||||
# 使用修改后的语法和主题构建一个 bat 二进制文件
|
||||
# Build a bat binary with modified syntaxes and themes
|
||||
bash assets/create.sh
|
||||
cargo install --path . --locked --force
|
||||
```
|
||||
|
||||
如果你想构建一个使用 `bat` 美化打印功能的应用程序,请查看 [API 文档](https://docs.rs/bat/)。请注意,当你依赖 `bat` 作为库时,必须使用 `regex-onig` 或 `regex-fancy` 作为特性。
|
||||
If you want to build an application that uses `bat`s pretty-printing
|
||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
||||
when you depend on `bat` as a library.
|
||||
|
||||
## 贡献指南
|
||||
## Contributing
|
||||
|
||||
请查看 [`CONTRIBUTING.md`](CONTRIBUTING.md) 指南。
|
||||
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||
|
||||
## 维护者
|
||||
## Maintainers
|
||||
|
||||
- [sharkdp](https://github.com/sharkdp)
|
||||
- [eth-p](https://github.com/eth-p)
|
||||
- [keith-hall](https://github.com/keith-hall)
|
||||
- [Enselic](https://github.com/Enselic)
|
||||
|
||||
## 安全漏洞
|
||||
## Security vulnerabilities
|
||||
|
||||
如果你想报告 `bat` 中的漏洞,请通过邮件联系 [David Peter](https://david-peter.de/)。
|
||||
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
||||
|
||||
## 项目目标和替代方案
|
||||
## Project goals and alternatives
|
||||
|
||||
`bat` 试图实现以下目标:
|
||||
`bat` tries to achieve the following goals:
|
||||
|
||||
- 提供美观的高级语法高亮
|
||||
- 与 Git 集成以显示文件修改
|
||||
- 成为 (POSIX) `cat` 的替代品
|
||||
- 提供用户友好的命令行界面
|
||||
- Provide beautiful, advanced syntax highlighting
|
||||
- Integrate with Git to show file modifications
|
||||
- Be a drop-in replacement for (POSIX) `cat`
|
||||
- Offer a user-friendly command-line interface
|
||||
|
||||
如果你在寻找类似的程序,有很多替代方案。请参阅[本文档](doc/alternatives.md)进行比较。
|
||||
There are a lot of alternatives, if you are looking for similar programs. See
|
||||
[this document](doc/alternatives.md) for a comparison.
|
||||
|
||||
## 许可证
|
||||
## License
|
||||
|
||||
版权所有 (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat)。
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` 可根据 MIT 许可证或 Apache 许可证 2.0 的条款使用,任选其一。
|
||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||
|
||||
有关许可证的详细信息,请参阅 [LICENSE-APACHE](LICENSE-APACHE) 和 [LICENSE-MIT](LICENSE-MIT) 文件。
|
||||
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
||||
|
@@ -26,7 +26,7 @@ in the `.sublime-syntax` format.
|
||||
4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
|
||||
`bat` binary.
|
||||
|
||||
5. Use `bat --list-languages` to check if the new languages are available. You may want to do something like ``export PATH="`pwd`/target/debug:$PATH"`` to ensure the locally compiled version is the one being used.
|
||||
5. Use `bat --list-languages` to check if the new languages are available.
|
||||
|
||||
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
||||
|
||||
@@ -102,4 +102,4 @@ The following files have been manually modified after converting from a `.tmLang
|
||||
https://github.com/seanjames777/SML-Language-Definition/blob/master/sml.tmLanguage
|
||||
* `Cabal.sublime_syntax` has been added manually from
|
||||
https://github.com/SublimeHaskell/SublimeHaskell/ - we don't want to include the whole submodule because it includes other syntaxes ("Haskell improved") as well.
|
||||
* `Lean.sublime-syntax` has been added manually from https://github.com/leanprover/vscode-lean4/blob/master/vscode-lean4/syntaxes/lean4.json via conversion.
|
||||
* `Lean.sublime-syntax` has been added manually from https://github.com/leanprover/vscode-lean/blob/master/syntaxes/lean.json via conversion.
|
||||
|
@@ -20,13 +20,6 @@ Options:
|
||||
* unicode (␇, ␊, ␀, ..)
|
||||
* caret (^G, ^J, ^@, ..)
|
||||
|
||||
--binary <behavior>
|
||||
How to treat binary content. (default: no-printing)
|
||||
|
||||
Possible values:
|
||||
* no-printing: do not print any binary content
|
||||
* as-text: treat binary content as normal text
|
||||
|
||||
-p, --plain...
|
||||
Only show plain style, no decorations. This is an alias for '--style=plain'. When '-p' is
|
||||
used twice ('-pp'), it also disables automatic paging (alias for '--style=plain
|
||||
@@ -119,42 +112,10 @@ Options:
|
||||
Set the theme for syntax highlighting. Use '--list-themes' to see all available themes. To
|
||||
set a default theme, add the '--theme="..."' option to the configuration file or export
|
||||
the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
|
||||
|
||||
Special values:
|
||||
|
||||
* auto: Picks a dark or light theme depending on the terminal's colors (default).
|
||||
Use '--theme-light' and '--theme-dark' to customize the selected theme.
|
||||
* auto:always: Detect the terminal's colors even when the output is redirected.
|
||||
* auto:system: Detect the color scheme from the system-wide preference (macOS only).
|
||||
* dark: Use the dark theme specified by '--theme-dark'.
|
||||
* light: Use the light theme specified by '--theme-light'.
|
||||
|
||||
--theme-light <theme>
|
||||
Sets the theme name for syntax highlighting used when the terminal uses a light
|
||||
background. Use '--list-themes' to see all available themes. To set a default theme, add
|
||||
the '--theme-light="..." option to the configuration file or export the BAT_THEME_LIGHT
|
||||
environment variable (e.g. export BAT_THEME_LIGHT="...").
|
||||
|
||||
--theme-dark <theme>
|
||||
Sets the theme name for syntax highlighting used when the terminal uses a dark background.
|
||||
Use '--list-themes' to see all available themes. To set a default theme, add the
|
||||
'--theme-dark="..." option to the configuration file or export the BAT_THEME_DARK
|
||||
environment variable (e.g. export BAT_THEME_DARK="...").
|
||||
|
||||
--list-themes
|
||||
Display a list of supported themes for syntax highlighting.
|
||||
|
||||
-s, --squeeze-blank
|
||||
Squeeze consecutive empty lines into a single empty line.
|
||||
|
||||
--squeeze-limit <squeeze-limit>
|
||||
Set the maximum number of consecutive empty lines to be printed.
|
||||
|
||||
--strip-ansi <when>
|
||||
Specify when to strip ANSI escape sequences from the input. The automatic mode will remove
|
||||
escape sequences unless the syntax highlighting language is plain text. Possible values:
|
||||
auto, always, *never*.
|
||||
|
||||
--style <components>
|
||||
Configure which elements (line numbers, file headers, grid borders, Git modifications, ..)
|
||||
to display in addition to the file contents. The argument is a comma-separated list of
|
||||
@@ -162,15 +123,6 @@ Options:
|
||||
set a default style, add the '--style=".."' option to the configuration file or export the
|
||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE="..").
|
||||
|
||||
When styles are specified in multiple places, the "nearest" set of styles take precedence.
|
||||
The command-line arguments are the highest priority, followed by the BAT_STYLE environment
|
||||
variable, and then the configuration file. If any set of styles consists entirely of
|
||||
components prefixed with "+" or "-", it will modify the previous set of styles instead of
|
||||
replacing them.
|
||||
|
||||
By default, the following components are enabled:
|
||||
changes, grid, header-filename, numbers, snip
|
||||
|
||||
Possible values:
|
||||
|
||||
* default: enables recommended style components (default).
|
||||
@@ -194,8 +146,6 @@ Options:
|
||||
'--line-range 40:' prints lines 40 to the end of the file
|
||||
'--line-range 40' only prints line 40
|
||||
'--line-range 30:+10' prints lines 30 to 40
|
||||
'--line-range 35::5' prints lines 30 to 40 (line 35 with 5 lines of context)
|
||||
'--line-range 30:40:2' prints lines 28 to 42 (range 30-40 with 2 lines of context)
|
||||
|
||||
-L, --list-languages
|
||||
Display a list of supported languages for syntax highlighting.
|
||||
@@ -204,18 +154,12 @@ Options:
|
||||
This option exists for POSIX-compliance reasons ('u' is for 'unbuffered'). The output is
|
||||
always unbuffered - this option is simply ignored.
|
||||
|
||||
--completion <SHELL>
|
||||
Show shell completion for a certain shell. [possible values: bash, fish, zsh, ps1]
|
||||
|
||||
--diagnostic
|
||||
Show diagnostic information for bug reports.
|
||||
|
||||
--acknowledgements
|
||||
Show acknowledgements.
|
||||
|
||||
--set-terminal-title
|
||||
Sets terminal title to filenames when using a pager.
|
||||
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
|
@@ -11,8 +11,6 @@ Options:
|
||||
Show non-printable characters (space, tab, newline, ..).
|
||||
--nonprintable-notation <notation>
|
||||
Set notation for non-printable characters.
|
||||
--binary <behavior>
|
||||
How to treat binary content. (default: no-printing)
|
||||
-p, --plain...
|
||||
Show plain style (alias for '--style=plain').
|
||||
-l, --language <language>
|
||||
@@ -43,14 +41,8 @@ Options:
|
||||
Use the specified syntax for files matching the glob pattern ('*.cpp:C++').
|
||||
--theme <theme>
|
||||
Set the color theme for syntax highlighting.
|
||||
--theme-light <theme>
|
||||
Sets the color theme for syntax highlighting used for light backgrounds.
|
||||
--theme-dark <theme>
|
||||
Sets the color theme for syntax highlighting used for dark backgrounds.
|
||||
--list-themes
|
||||
Display all supported highlighting themes.
|
||||
-s, --squeeze-blank
|
||||
Squeeze consecutive empty lines.
|
||||
--style <components>
|
||||
Comma-separated list of style elements to display (*default*, auto, full, plain, changes,
|
||||
header, header-filename, header-filesize, grid, rule, numbers, snip).
|
||||
@@ -58,8 +50,6 @@ Options:
|
||||
Only print the lines from N to M.
|
||||
-L, --list-languages
|
||||
Display all supported languages.
|
||||
--completion <SHELL>
|
||||
Show shell completion for a certain shell. [possible values: bash, fish, zsh, ps1]
|
||||
-h, --help
|
||||
Print help (see more with '--help')
|
||||
-V, --version
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 817 KiB |
Binary file not shown.
Before Width: | Height: | Size: 37 KiB |
11
doc/sponsors/workos-logo-white-bg.svg
Normal file
11
doc/sponsors/workos-logo-white-bg.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg width="1354" height="420" viewBox="0 0 1354 420" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="1354" height="420" rx="20" fill="white"/>
|
||||
<path d="M434.751 133.122H466.637L489.595 227.729C493.852 245.585 494.697 256.219 494.697 256.219H495.128C495.128 256.219 496.61 245.808 500.867 227.729L522.757 133.122H558.9L582.066 227.729C586.53 246.223 587.598 256.219 587.598 256.219H588.236C588.236 256.219 588.666 246.223 592.907 227.729L615.02 133.122H646.907L606.523 288.313H571.017L546.576 194.344C541.474 173.936 541.044 164.801 541.044 164.801H540.614C540.614 164.801 540.183 173.936 535.512 194.344L512.553 288.313H475.996L434.751 133.122Z" fill="black"/>
|
||||
<path d="M641.583 231.934C641.583 196.428 664.541 173.47 699.202 173.47C733.639 173.47 756.597 196.428 756.597 231.934C756.597 267.647 733.639 290.828 699.202 290.828C664.557 290.812 641.583 267.647 641.583 231.934ZM726.832 231.934C726.832 208.976 715.783 195.998 699.202 195.998C681.346 195.998 671.349 210.458 671.349 231.934C671.349 255.323 682.398 268.284 699.202 268.284C717.058 268.284 726.832 253.824 726.832 231.934Z" fill="black"/>
|
||||
<path d="M770.836 175.21H799.103V196.048H799.741C804.635 185.207 816.322 174.365 836.299 174.365C839.695 174.365 841.831 174.796 843.314 175.21V203.478H842.469C842.469 203.478 839.918 202.633 832.903 202.633C811.013 202.633 799.103 215.594 799.103 239.828V288.295H770.836V175.21Z" fill="black"/>
|
||||
<path d="M856.5 133.122H884.767V182.865C884.767 212.2 884.336 217.509 884.336 217.509H884.767L926.857 175.212H962.139L912.843 224.11L970.031 288.313H936.646L895.401 241.536L884.767 251.946V288.297H856.5V133.122Z" fill="black"/>
|
||||
<path d="M970.444 211.285C970.444 163.455 1000.21 131.569 1044.85 131.569C1089.49 131.569 1119.26 163.455 1119.26 211.285C1119.26 259.114 1089.49 291.001 1044.85 291.001C1000.21 291.001 970.444 259.114 970.444 211.285ZM1088.42 211.285C1088.42 178.761 1071 156.855 1044.84 156.855C1018.67 156.855 1001.26 178.761 1001.26 211.285C1001.26 243.809 1018.69 265.715 1044.84 265.715C1070.98 265.715 1088.42 243.809 1088.42 211.285Z" fill="black"/>
|
||||
<path d="M1130.08 236.656H1162.4C1162.4 254.943 1174.95 265.146 1194.08 265.146C1210.23 265.146 1221.29 257.063 1221.29 245.584C1221.29 232.622 1212.79 229.21 1185.79 223.901C1161.12 219.007 1134.98 210.716 1134.98 178.399C1134.98 151.408 1157.93 131 1193.01 131C1229.57 131 1252.11 150.132 1252.11 179.037H1219.79C1219.79 165.007 1208.95 156.286 1193.01 156.286C1176.86 156.286 1166.86 164.146 1166.86 175.625C1166.86 187.742 1173.88 192.413 1195.56 196.878C1227.65 203.685 1254.02 207.288 1254.02 243.001C1254.02 271.3 1229.36 290.432 1193.01 290.432C1156.02 290.432 1130.08 268.957 1130.08 236.656Z" fill="black"/>
|
||||
<path d="M100 210C100 214.824 101.269 219.647 103.723 223.793L148.231 300.878C152.8 308.747 159.739 315.178 168.369 318.055C185.377 323.724 202.977 316.447 211.354 301.893L222.1 283.278L179.708 210L224.47 132.408L235.216 113.792C238.431 108.208 242.747 103.638 247.824 100H243.17H178.777C166.677 100 155.508 106.431 149.5 116.923L103.723 196.208C101.269 200.354 100 205.177 100 210Z" fill="#6363F1"/>
|
||||
<path d="M353.847 210C353.847 205.177 352.578 200.353 350.124 196.207L305.024 118.107C296.647 103.638 279.047 96.3608 262.039 101.945C253.409 104.822 246.47 111.253 241.901 119.122L231.747 136.638L274.139 210L229.378 287.592L218.632 306.208C215.416 311.708 211.101 316.362 206.024 320H210.678H275.07C287.17 320 298.34 313.569 304.347 303.077L350.124 223.792C352.578 219.646 353.847 214.823 353.847 210Z" fill="#6363F1"/>
|
||||
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
@@ -1,6 +1,4 @@
|
||||
use bat::{
|
||||
assets::HighlightingAssets, config::Config, controller::Controller, output::OutputHandle, Input,
|
||||
};
|
||||
use bat::{assets::HighlightingAssets, config::Config, controller::Controller, Input};
|
||||
|
||||
fn main() {
|
||||
let mut buffer = String::new();
|
||||
@@ -12,10 +10,7 @@ fn main() {
|
||||
let controller = Controller::new(&config, &assets);
|
||||
let input = Input::from_file(file!());
|
||||
controller
|
||||
.run(
|
||||
vec![input.into()],
|
||||
Some(OutputHandle::FmtWrite(&mut buffer)),
|
||||
)
|
||||
.run(vec![input.into()], Some(&mut buffer))
|
||||
.unwrap();
|
||||
|
||||
println!("{buffer}");
|
||||
|
@@ -13,6 +13,6 @@ fn main() {
|
||||
|
||||
println!("Themes:");
|
||||
for theme in printer.themes() {
|
||||
println!("- {theme}");
|
||||
println!("- {}", theme);
|
||||
}
|
||||
}
|
||||
|
164
src/assets.rs
164
src/assets.rs
@@ -13,7 +13,6 @@ use crate::error::*;
|
||||
use crate::input::{InputReader, OpenedInput};
|
||||
use crate::syntax_mapping::ignored_suffixes::IgnoredSuffixes;
|
||||
use crate::syntax_mapping::MappingTarget;
|
||||
use crate::theme::{default_theme, ColorScheme};
|
||||
use crate::{bat_warning, SyntaxMapping};
|
||||
|
||||
use lazy_theme_set::LazyThemeSet;
|
||||
@@ -70,6 +69,57 @@ impl HighlightingAssets {
|
||||
}
|
||||
}
|
||||
|
||||
/// The default theme.
|
||||
///
|
||||
/// ### Windows and Linux
|
||||
///
|
||||
/// Windows and most Linux distributions has a dark terminal theme by
|
||||
/// default. On these platforms, this function always returns a theme that
|
||||
/// looks good on a dark background.
|
||||
///
|
||||
/// ### macOS
|
||||
///
|
||||
/// On macOS the default terminal background is light, but it is common that
|
||||
/// Dark Mode is active, which makes the terminal background dark. On this
|
||||
/// platform, the default theme depends on
|
||||
/// ```bash
|
||||
/// defaults read -globalDomain AppleInterfaceStyle
|
||||
/// ```
|
||||
/// To avoid the overhead of the check on macOS, simply specify a theme
|
||||
/// explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.
|
||||
///
|
||||
/// See <https://github.com/sharkdp/bat/issues/1746> and
|
||||
/// <https://github.com/sharkdp/bat/issues/1928> for more context.
|
||||
pub fn default_theme() -> &'static str {
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
Self::default_dark_theme()
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
if macos_dark_mode_active() {
|
||||
Self::default_dark_theme()
|
||||
} else {
|
||||
Self::default_light_theme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The default theme that looks good on a dark background.
|
||||
*/
|
||||
fn default_dark_theme() -> &'static str {
|
||||
"Monokai Extended"
|
||||
}
|
||||
|
||||
/**
|
||||
* The default theme that looks good on a light background.
|
||||
*/
|
||||
#[cfg(target_os = "macos")]
|
||||
fn default_light_theme() -> &'static str {
|
||||
"Monokai Extended Light"
|
||||
}
|
||||
|
||||
pub fn from_cache(cache_path: &Path) -> Result<Self> {
|
||||
Ok(HighlightingAssets::new(
|
||||
SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
|
||||
@@ -152,7 +202,7 @@ impl HighlightingAssets {
|
||||
&self,
|
||||
path: impl AsRef<Path>,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<SyntaxReferenceInSet<'_>> {
|
||||
) -> Result<SyntaxReferenceInSet> {
|
||||
let path = path.as_ref();
|
||||
|
||||
let syntax_match = mapping.get_syntax_for(path);
|
||||
@@ -163,7 +213,7 @@ impl HighlightingAssets {
|
||||
|
||||
if let Some(MappingTarget::MapTo(syntax_name)) = syntax_match {
|
||||
return self
|
||||
.find_syntax_by_token(syntax_name)?
|
||||
.find_syntax_by_name(syntax_name)?
|
||||
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned()));
|
||||
}
|
||||
|
||||
@@ -191,17 +241,14 @@ impl HighlightingAssets {
|
||||
Some(theme) => theme,
|
||||
None => {
|
||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||
bat_warning!("Theme '{theme}' is deprecated, using 'ansi' instead.");
|
||||
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
||||
return self.get_theme("ansi");
|
||||
}
|
||||
if !theme.is_empty() {
|
||||
bat_warning!("Unknown theme '{theme}', using default.")
|
||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||
}
|
||||
self.get_theme_set()
|
||||
.get(
|
||||
self.fallback_theme
|
||||
.unwrap_or_else(|| default_theme(ColorScheme::Dark)),
|
||||
)
|
||||
.get(self.fallback_theme.unwrap_or_else(Self::default_theme))
|
||||
.expect("something is very wrong if the default theme is missing")
|
||||
}
|
||||
}
|
||||
@@ -212,7 +259,7 @@ impl HighlightingAssets {
|
||||
language: Option<&str>,
|
||||
input: &mut OpenedInput,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<SyntaxReferenceInSet<'_>> {
|
||||
) -> Result<SyntaxReferenceInSet> {
|
||||
if let Some(language) = language {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
return syntax_set
|
||||
@@ -244,17 +291,14 @@ impl HighlightingAssets {
|
||||
pub(crate) fn find_syntax_by_name(
|
||||
&self,
|
||||
syntax_name: &str,
|
||||
) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(syntax_set
|
||||
.find_syntax_by_name(syntax_name)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn find_syntax_by_extension(
|
||||
&self,
|
||||
e: Option<&OsStr>,
|
||||
) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
fn find_syntax_by_extension(&self, e: Option<&OsStr>) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
let extension = e.and_then(|x| x.to_str()).unwrap_or_default();
|
||||
Ok(syntax_set
|
||||
@@ -262,18 +306,11 @@ impl HighlightingAssets {
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn find_syntax_by_token(&self, token: &str) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(syntax_set
|
||||
.find_syntax_by_token(token)
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
|
||||
fn get_syntax_for_file_name(
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
ignored_suffixes: &IgnoredSuffixes,
|
||||
) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let mut syntax = self.find_syntax_by_extension(Some(file_name))?;
|
||||
if syntax.is_none() {
|
||||
syntax =
|
||||
@@ -289,7 +326,7 @@ impl HighlightingAssets {
|
||||
&self,
|
||||
file_name: &OsStr,
|
||||
ignored_suffixes: &IgnoredSuffixes,
|
||||
) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let mut syntax = self.find_syntax_by_extension(Path::new(file_name).extension())?;
|
||||
if syntax.is_none() {
|
||||
syntax =
|
||||
@@ -304,15 +341,11 @@ impl HighlightingAssets {
|
||||
fn get_first_line_syntax(
|
||||
&self,
|
||||
reader: &mut InputReader,
|
||||
) -> Result<Option<SyntaxReferenceInSet<'_>>> {
|
||||
) -> Result<Option<SyntaxReferenceInSet>> {
|
||||
let syntax_set = self.get_syntax_set()?;
|
||||
Ok(String::from_utf8(reader.first_line.clone())
|
||||
.ok()
|
||||
.and_then(|l| {
|
||||
// Strip UTF-8 BOM if present
|
||||
let line = l.strip_prefix('\u{feff}').unwrap_or(&l);
|
||||
syntax_set.find_syntax_by_first_line(line)
|
||||
})
|
||||
.and_then(|l| syntax_set.find_syntax_by_first_line(&l))
|
||||
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
|
||||
}
|
||||
}
|
||||
@@ -347,7 +380,7 @@ fn asset_from_contents<T: serde::de::DeserializeOwned>(
|
||||
} else {
|
||||
bincode::deserialize_from(contents)
|
||||
}
|
||||
.map_err(|_| format!("Could not parse {description}").into())
|
||||
.map_err(|_| format!("Could not parse {}", description).into())
|
||||
}
|
||||
|
||||
fn asset_from_cache<T: serde::de::DeserializeOwned>(
|
||||
@@ -357,12 +390,33 @@ fn asset_from_cache<T: serde::de::DeserializeOwned>(
|
||||
) -> Result<T> {
|
||||
let contents = fs::read(path).map_err(|_| {
|
||||
format!(
|
||||
"Could not load cached {description} '{}'",
|
||||
"Could not load cached {} '{}'",
|
||||
description,
|
||||
path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
asset_from_contents(&contents[..], description, compressed)
|
||||
.map_err(|_| format!("Could not parse cached {description}").into())
|
||||
.map_err(|_| format!("Could not parse cached {}", description).into())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn macos_dark_mode_active() -> bool {
|
||||
const PREFERENCES_FILE: &str = "Library/Preferences/.GlobalPreferences.plist";
|
||||
const STYLE_KEY: &str = "AppleInterfaceStyle";
|
||||
|
||||
let preferences_file = home::home_dir()
|
||||
.map(|home| home.join(PREFERENCES_FILE))
|
||||
.expect("Could not get home directory");
|
||||
|
||||
match plist::Value::from_file(preferences_file).map(|file| file.into_dictionary()) {
|
||||
Ok(Some(preferences)) => match preferences.get(STYLE_KEY).and_then(|val| val.as_string()) {
|
||||
Some(value) => value == "Dark",
|
||||
// If the key does not exist, then light theme is currently in use.
|
||||
None => false,
|
||||
},
|
||||
// Unreachable, in theory. All macOS users have a home directory and preferences file setup.
|
||||
Ok(None) | Err(_) => true,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -383,11 +437,11 @@ mod tests {
|
||||
pub temp_dir: TempDir,
|
||||
}
|
||||
|
||||
impl SyntaxDetectionTest<'_> {
|
||||
impl<'a> SyntaxDetectionTest<'a> {
|
||||
fn new() -> Self {
|
||||
SyntaxDetectionTest {
|
||||
assets: HighlightingAssets::from_binary(),
|
||||
syntax_mapping: SyntaxMapping::new(),
|
||||
syntax_mapping: SyntaxMapping::builtin(),
|
||||
temp_dir: TempDir::new().expect("creation of temporary directory"),
|
||||
}
|
||||
}
|
||||
@@ -412,7 +466,7 @@ mod tests {
|
||||
let file_path = self.temp_dir.path().join(file_name);
|
||||
{
|
||||
let mut temp_file = File::create(&file_path).unwrap();
|
||||
writeln!(temp_file, "{first_line}").unwrap();
|
||||
writeln!(temp_file, "{}", first_line).unwrap();
|
||||
}
|
||||
|
||||
let input = Input::ordinary_file(&file_path);
|
||||
@@ -460,7 +514,8 @@ mod tests {
|
||||
|
||||
if !consistent {
|
||||
eprintln!(
|
||||
"Inconsistent syntax detection:\nFor File: {as_file}\nFor Reader: {as_reader}"
|
||||
"Inconsistent syntax detection:\nFor File: {}\nFor Reader: {}",
|
||||
as_file, as_reader
|
||||
)
|
||||
}
|
||||
|
||||
@@ -546,41 +601,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn syntax_detection_first_line_with_utf8_bom() {
|
||||
let test = SyntaxDetectionTest::new();
|
||||
|
||||
// Test that XML files are detected correctly even with UTF-8 BOM
|
||||
// The BOM should be stripped before first-line syntax detection
|
||||
let xml_with_bom = "\u{feff}<?xml version=\"1.0\" encoding=\"utf-8\"?>";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_file", xml_with_bom),
|
||||
"XML"
|
||||
);
|
||||
|
||||
// Test the specific .csproj case mentioned in the issue
|
||||
// Even if .csproj has extension mapping, this tests first-line fallback
|
||||
let csproj_content_with_bom = "\u{feff}<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("test.csproj", csproj_content_with_bom),
|
||||
"XML"
|
||||
);
|
||||
|
||||
// Test that shell scripts are detected correctly even with UTF-8 BOM
|
||||
let script_with_bom = "\u{feff}#!/bin/bash";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_script", script_with_bom),
|
||||
"Bourne Again Shell (bash)"
|
||||
);
|
||||
|
||||
// Test that PHP files are detected correctly even with UTF-8 BOM
|
||||
let php_with_bom = "\u{feff}<?php";
|
||||
assert_eq!(
|
||||
test.syntax_for_file_with_content("unknown_php", php_with_bom),
|
||||
"PHP"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn syntax_detection_with_custom_mapping() {
|
||||
let mut test = SyntaxDetectionTest::new();
|
||||
|
@@ -3,7 +3,7 @@ use std::path::Path;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use semver::Version;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::*;
|
||||
|
||||
@@ -40,15 +40,15 @@ impl AssetsMetadata {
|
||||
/// Load metadata about the stored cache file from the given folder.
|
||||
///
|
||||
/// There are several possibilities:
|
||||
/// - We find a `metadata.yaml` file and are able to parse it
|
||||
/// - return the contained information
|
||||
/// - We find a `metadata.yaml` file, but are not able to parse it
|
||||
/// - return a [`Error::SerdeYamlError`]
|
||||
/// - We do not find a `metadata.yaml` file but a `syntaxes.bin` or `themes.bin` file
|
||||
/// - assume that these were created by an old version of bat and return
|
||||
/// [`AssetsMetadata::default()`] without version information
|
||||
/// - We do not find a `metadata.yaml` file and no cached assets
|
||||
/// - no user provided assets are available, return `None`
|
||||
/// - We find a metadata.yaml file and are able to parse it
|
||||
/// => return the contained information
|
||||
/// - We find a metadata.yaml file and but are not able to parse it
|
||||
/// => return a SerdeYamlError
|
||||
/// - We do not find a metadata.yaml file but a syntaxes.bin or themes.bin file
|
||||
/// => assume that these were created by an old version of bat and return
|
||||
/// AssetsMetadata::default() without version information
|
||||
/// - We do not find a metadata.yaml file and no cached assets
|
||||
/// => no user provided assets are available, return None
|
||||
pub fn load_from_folder(path: &Path) -> Result<Option<Self>> {
|
||||
match Self::try_load_from_folder(path) {
|
||||
Ok(metadata) => Ok(Some(metadata)),
|
||||
|
@@ -47,8 +47,9 @@ fn build_theme_set(source_dir: &Path, include_integrated_assets: bool) -> Result
|
||||
let res = theme_set.add_from_folder(&theme_dir);
|
||||
if let Err(err) = res {
|
||||
println!(
|
||||
"Failed to load one or more themes from '{}' (reason: '{err}')",
|
||||
"Failed to load one or more themes from '{}' (reason: '{}')",
|
||||
theme_dir.to_string_lossy(),
|
||||
err,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -92,7 +93,7 @@ fn print_unlinked_contexts(syntax_set: &SyntaxSet) {
|
||||
if !missing_contexts.is_empty() {
|
||||
println!("Some referenced contexts could not be found!");
|
||||
for context in missing_contexts {
|
||||
println!("- {context}");
|
||||
println!("- {}", context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +152,7 @@ pub(crate) fn asset_to_contents<T: serde::Serialize>(
|
||||
} else {
|
||||
bincode::serialize_into(&mut contents, asset)
|
||||
}
|
||||
.map_err(|_| format!("Could not serialize {description}"))?;
|
||||
.map_err(|_| format!("Could not serialize {}", description))?;
|
||||
Ok(contents)
|
||||
}
|
||||
|
||||
@@ -161,10 +162,15 @@ fn asset_to_cache<T: serde::Serialize>(
|
||||
description: &str,
|
||||
compressed: bool,
|
||||
) -> Result<()> {
|
||||
print!("Writing {description} to {} ... ", path.to_string_lossy());
|
||||
print!("Writing {} to {} ... ", description, path.to_string_lossy());
|
||||
let contents = asset_to_contents(asset, description, compressed)?;
|
||||
std::fs::write(path, &contents[..])
|
||||
.map_err(|_| format!("Could not save {description} to {}", path.to_string_lossy()))?;
|
||||
std::fs::write(path, &contents[..]).map_err(|_| {
|
||||
format!(
|
||||
"Could not save {} to {}",
|
||||
description,
|
||||
path.to_string_lossy()
|
||||
)
|
||||
})?;
|
||||
println!("okay");
|
||||
Ok(())
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ fn to_path_and_stem(source_dir: &Path, entry: DirEntry) -> Option<PathAndStem> {
|
||||
fn handle_file(path_and_stem: &PathAndStem) -> Result<Option<String>> {
|
||||
if path_and_stem.stem == "NOTICE" {
|
||||
handle_notice(&path_and_stem.path)
|
||||
} else if path_and_stem.stem.eq_ignore_ascii_case("LICENSE") {
|
||||
} else if path_and_stem.stem.to_ascii_uppercase() == "LICENSE" {
|
||||
handle_license(&path_and_stem.path)
|
||||
} else {
|
||||
Ok(None)
|
||||
@@ -80,7 +80,7 @@ fn handle_license(path: &Path) -> Result<Option<String>> {
|
||||
} else if license_not_needed_in_acknowledgements(&license_text) {
|
||||
Ok(None)
|
||||
} else {
|
||||
Err(format!("ERROR: License is of unknown type: {path:?}").into())
|
||||
Err(format!("ERROR: License is of unknown type: {:?}", path).into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,9 +95,6 @@ fn include_license_in_acknowledgments(license_text: &str) -> bool {
|
||||
// Apache 2.0
|
||||
"Apache License Version 2.0, January 2004 http://www.apache.org/licenses/",
|
||||
"Licensed under the Apache License, Version 2.0 (the \"License\");",
|
||||
|
||||
// CC BY 4.0
|
||||
"Creative Commons Attribution 4.0 International Public License",
|
||||
];
|
||||
|
||||
license_contains_marker(license_text, &markers)
|
||||
@@ -128,7 +125,7 @@ fn append_to_acknowledgements(
|
||||
relative_path: &str,
|
||||
license_text: &str,
|
||||
) {
|
||||
write!(acknowledgements, "## {relative_path}\n\n{license_text}").ok();
|
||||
write!(acknowledgements, "## {}\n\n{}", relative_path, license_text).ok();
|
||||
|
||||
// Make sure the last char is a newline to not mess up formatting later
|
||||
if acknowledgements
|
||||
|
@@ -3,7 +3,8 @@ use super::*;
|
||||
use std::collections::BTreeMap;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use once_cell::unsync::OnceCell;
|
||||
|
||||
@@ -88,7 +89,7 @@ impl TryFrom<ThemeSet> for LazyThemeSet {
|
||||
let lazy_theme = LazyTheme {
|
||||
serialized: crate::assets::build_assets::asset_to_contents(
|
||||
&theme,
|
||||
&format!("theme {name}"),
|
||||
&format!("theme {}", name),
|
||||
COMPRESS_LAZY_THEMES,
|
||||
)?,
|
||||
deserialized: OnceCell::new(),
|
||||
|
@@ -2,23 +2,18 @@ use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::io::IsTerminal;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::thread::available_parallelism;
|
||||
|
||||
use crate::{
|
||||
clap_app,
|
||||
config::{get_args_from_config_file, get_args_from_env_opts_var, get_args_from_env_vars},
|
||||
};
|
||||
use bat::style::StyleComponentList;
|
||||
use bat::theme::{theme, ThemeName, ThemeOptions, ThemePreference};
|
||||
use bat::BinaryBehavior;
|
||||
use bat::StripAnsiMode;
|
||||
use clap::ArgMatches;
|
||||
|
||||
use console::Term;
|
||||
|
||||
use crate::input::{new_file_input, new_stdin_input};
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
bat_warning,
|
||||
config::{Config, VisibleLines},
|
||||
error::*,
|
||||
@@ -90,45 +85,25 @@ impl App {
|
||||
|
||||
// .. and the rest at the end
|
||||
cli_args.for_each(|a| args.push(a));
|
||||
|
||||
args
|
||||
};
|
||||
|
||||
Ok(clap_app::build_app(interactive_output).get_matches_from(args))
|
||||
}
|
||||
|
||||
pub fn config(&self, inputs: &[Input]) -> Result<Config<'_>> {
|
||||
pub fn config(&self, inputs: &[Input]) -> Result<Config> {
|
||||
let style_components = self.style_components()?;
|
||||
|
||||
let extra_plain = self.matches.get_count("plain") > 1;
|
||||
let plain_last_index = self
|
||||
.matches
|
||||
.indices_of("plain")
|
||||
.and_then(Iterator::max)
|
||||
.unwrap_or_default();
|
||||
let paging_last_index = self
|
||||
.matches
|
||||
.indices_of("paging")
|
||||
.and_then(Iterator::max)
|
||||
.unwrap_or_default();
|
||||
|
||||
let paging_mode = match self.matches.get_one::<String>("paging").map(|s| s.as_str()) {
|
||||
Some("always") => {
|
||||
// Disable paging if the second -p (or -pp) is specified after --paging=always
|
||||
if extra_plain && plain_last_index > paging_last_index {
|
||||
PagingMode::Never
|
||||
} else {
|
||||
PagingMode::Always
|
||||
}
|
||||
}
|
||||
Some("always") => PagingMode::Always,
|
||||
Some("never") => PagingMode::Never,
|
||||
Some("auto") | None => {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
let extra_plain = self.matches.get_count("plain") > 1;
|
||||
if extra_plain || self.matches.get_flag("no-paging") {
|
||||
PagingMode::Never
|
||||
} else if inputs.iter().any(Input::is_stdin)
|
||||
// ignore stdin when --list-themes is used because in that case no input will be read anyways
|
||||
&& !self.matches.get_flag("list-themes")
|
||||
{
|
||||
} else if inputs.iter().any(Input::is_stdin) {
|
||||
// If we are reading from stdin, only enable paging if we write to an
|
||||
// interactive terminal and if we do not *read* from an interactive
|
||||
// terminal.
|
||||
@@ -146,13 +121,7 @@ impl App {
|
||||
_ => unreachable!("other values for --paging are not allowed"),
|
||||
};
|
||||
|
||||
let mut syntax_mapping = SyntaxMapping::new();
|
||||
// start building glob matchers for builtin mappings immediately
|
||||
// this is an appropriate approach because it's statistically likely that
|
||||
// all the custom mappings need to be checked
|
||||
if available_parallelism()?.get() > 1 {
|
||||
syntax_mapping.start_offload_build_all();
|
||||
}
|
||||
let mut syntax_mapping = SyntaxMapping::builtin();
|
||||
|
||||
if let Some(values) = self.matches.get_many::<String>("ignored-suffix") {
|
||||
for suffix in values {
|
||||
@@ -161,9 +130,7 @@ impl App {
|
||||
}
|
||||
|
||||
if let Some(values) = self.matches.get_many::<String>("map-syntax") {
|
||||
// later args take precedence over earlier ones, hence `.rev()`
|
||||
// see: https://github.com/sharkdp/bat/pull/2755#discussion_r1456416875
|
||||
for from_to in values.rev() {
|
||||
for from_to in values {
|
||||
let parts: Vec<_> = from_to.split(':').collect();
|
||||
|
||||
if parts.len() != 2 {
|
||||
@@ -218,11 +185,6 @@ impl App {
|
||||
Some("caret") => NonprintableNotation::Caret,
|
||||
_ => unreachable!("other values for --nonprintable-notation are not allowed"),
|
||||
},
|
||||
binary: match self.matches.get_one::<String>("binary").map(|s| s.as_str()) {
|
||||
Some("as-text") => BinaryBehavior::AsText,
|
||||
Some("no-printing") => BinaryBehavior::NoPrinting,
|
||||
_ => unreachable!("other values for --binary are not allowed"),
|
||||
},
|
||||
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||
if !self.matches.get_flag("chop-long-lines") {
|
||||
match self.matches.get_one::<String>("wrap").map(|s| s.as_str()) {
|
||||
@@ -274,17 +236,18 @@ impl App {
|
||||
4
|
||||
},
|
||||
),
|
||||
strip_ansi: match self
|
||||
theme: self
|
||||
.matches
|
||||
.get_one::<String>("strip-ansi")
|
||||
.map(|s| s.as_str())
|
||||
{
|
||||
Some("never") => StripAnsiMode::Never,
|
||||
Some("always") => StripAnsiMode::Always,
|
||||
Some("auto") => StripAnsiMode::Auto,
|
||||
_ => unreachable!("other values for --strip-ansi are not allowed"),
|
||||
},
|
||||
theme: theme(self.theme_options()).to_string(),
|
||||
.get_one::<String>("theme")
|
||||
.map(String::from)
|
||||
.map(|s| {
|
||||
if s == "default" {
|
||||
String::from(HighlightingAssets::default_theme())
|
||||
} else {
|
||||
s
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
|
||||
visible_lines: match self.matches.try_contains_id("diff").unwrap_or_default()
|
||||
&& self.matches.get_flag("diff")
|
||||
{
|
||||
@@ -324,21 +287,10 @@ impl App {
|
||||
use_custom_assets: !self.matches.get_flag("no-custom-assets"),
|
||||
#[cfg(feature = "lessopen")]
|
||||
use_lessopen: self.matches.get_flag("lessopen"),
|
||||
set_terminal_title: self.matches.get_flag("set-terminal-title"),
|
||||
squeeze_lines: if self.matches.get_flag("squeeze-blank") {
|
||||
Some(
|
||||
self.matches
|
||||
.get_one::<usize>("squeeze-limit")
|
||||
.map(|limit| limit.to_owned())
|
||||
.unwrap_or(1),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
pub fn inputs(&self) -> Result<Vec<Input<'_>>> {
|
||||
pub fn inputs(&self) -> Result<Vec<Input>> {
|
||||
let filenames: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.get_many::<PathBuf>("file-name")
|
||||
@@ -384,57 +336,34 @@ impl App {
|
||||
Ok(file_input)
|
||||
}
|
||||
|
||||
fn forced_style_components(&self) -> Option<StyleComponents> {
|
||||
// No components if `--decorations=never``.
|
||||
if self
|
||||
.matches
|
||||
.get_one::<String>("decorations")
|
||||
.map(|s| s.as_str())
|
||||
== Some("never")
|
||||
{
|
||||
return Some(StyleComponents(HashSet::new()));
|
||||
}
|
||||
|
||||
// Only line numbers if `--number`.
|
||||
if self.matches.get_flag("number") {
|
||||
return Some(StyleComponents(HashSet::from([
|
||||
StyleComponent::LineNumbers,
|
||||
])));
|
||||
}
|
||||
|
||||
// Plain if `--plain` is specified at least once.
|
||||
if self.matches.get_count("plain") > 0 {
|
||||
return Some(StyleComponents(HashSet::from([StyleComponent::Plain])));
|
||||
}
|
||||
|
||||
// Default behavior.
|
||||
None
|
||||
}
|
||||
|
||||
fn style_components(&self) -> Result<StyleComponents> {
|
||||
let matches = &self.matches;
|
||||
let mut styled_components = match self.forced_style_components() {
|
||||
Some(forced_components) => forced_components,
|
||||
|
||||
// Parse the `--style` arguments and merge them.
|
||||
None if matches.contains_id("style") => {
|
||||
let lists = matches
|
||||
.get_many::<String>("style")
|
||||
.expect("styles present")
|
||||
.map(|v| StyleComponentList::from_str(v))
|
||||
.collect::<Result<Vec<StyleComponentList>>>()?;
|
||||
|
||||
StyleComponentList::to_components(lists, self.interactive_output, true)
|
||||
}
|
||||
|
||||
// Use the default.
|
||||
None => StyleComponents(HashSet::from_iter(
|
||||
StyleComponent::Default
|
||||
.components(self.interactive_output)
|
||||
.iter()
|
||||
.cloned(),
|
||||
)),
|
||||
};
|
||||
let mut styled_components = StyleComponents(
|
||||
if matches.get_one::<String>("decorations").map(|s| s.as_str()) == Some("never") {
|
||||
HashSet::new()
|
||||
} else if matches.get_flag("number") {
|
||||
[StyleComponent::LineNumbers].iter().cloned().collect()
|
||||
} else if 0 < matches.get_count("plain") {
|
||||
[StyleComponent::Plain].iter().cloned().collect()
|
||||
} else {
|
||||
matches
|
||||
.get_one::<String>("style")
|
||||
.map(|styles| {
|
||||
styles
|
||||
.split(',')
|
||||
.map(|style| style.parse::<StyleComponent>())
|
||||
.filter_map(|style| style.ok())
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_else(|| vec![StyleComponent::Default])
|
||||
.into_iter()
|
||||
.map(|style| style.components(self.interactive_output))
|
||||
.fold(HashSet::new(), |mut acc, components| {
|
||||
acc.extend(components.iter().cloned());
|
||||
acc
|
||||
})
|
||||
},
|
||||
);
|
||||
|
||||
// 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) {
|
||||
@@ -443,25 +372,4 @@ impl App {
|
||||
|
||||
Ok(styled_components)
|
||||
}
|
||||
|
||||
fn theme_options(&self) -> ThemeOptions {
|
||||
let theme = self
|
||||
.matches
|
||||
.get_one::<String>("theme")
|
||||
.map(|t| ThemePreference::from_str(t).unwrap())
|
||||
.unwrap_or_default();
|
||||
let theme_dark = self
|
||||
.matches
|
||||
.get_one::<String>("theme-dark")
|
||||
.map(|t| ThemeName::from_str(t).unwrap());
|
||||
let theme_light = self
|
||||
.matches
|
||||
.get_one::<String>("theme-light")
|
||||
.map(|t| ThemeName::from_str(t).unwrap());
|
||||
ThemeOptions {
|
||||
theme,
|
||||
theme_dark,
|
||||
theme_light,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,13 +44,13 @@ pub fn assets_from_cache_or_binary(
|
||||
}
|
||||
|
||||
fn clear_asset(path: PathBuf, description: &str) {
|
||||
print!("Clearing {description} ... ");
|
||||
print!("Clearing {} ... ", description);
|
||||
match fs::remove_file(&path) {
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||
println!("skipped (not present)");
|
||||
}
|
||||
Err(err) => {
|
||||
println!("could not remove the cache file {path:?}: {err}");
|
||||
println!("could not remove the cache file {:?}: {}", &path, err);
|
||||
}
|
||||
Ok(_) => println!("okay"),
|
||||
}
|
||||
|
@@ -1,11 +1,9 @@
|
||||
use bat::style::StyleComponentList;
|
||||
use clap::{
|
||||
crate_name, crate_version, value_parser, Arg, ArgAction, ArgGroup, ColorChoice, Command,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
|
||||
static VERSION: Lazy<String> = Lazy::new(|| {
|
||||
#[cfg(feature = "bugreport")]
|
||||
@@ -16,7 +14,7 @@ static VERSION: Lazy<String> = Lazy::new(|| {
|
||||
if git_version.is_empty() {
|
||||
crate_version!().to_string()
|
||||
} else {
|
||||
format!("{} ({git_version})", crate_version!())
|
||||
format!("{} ({})", crate_version!(), git_version)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,26 +75,11 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
* caret (^G, ^J, ^@, ..)",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("binary")
|
||||
.long("binary")
|
||||
.action(ArgAction::Set)
|
||||
.default_value("no-printing")
|
||||
.value_parser(["no-printing", "as-text"])
|
||||
.value_name("behavior")
|
||||
.hide_default_value(true)
|
||||
.help("How to treat binary content. (default: no-printing)")
|
||||
.long_help(
|
||||
"How to treat binary content. (default: no-printing)\n\n\
|
||||
Possible values:\n \
|
||||
* no-printing: do not print any binary content\n \
|
||||
* as-text: treat binary content as normal text",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("plain")
|
||||
.overrides_with("plain")
|
||||
.overrides_with("number")
|
||||
.overrides_with("paging")
|
||||
.short('p')
|
||||
.long("plain")
|
||||
.action(ArgAction::Count)
|
||||
@@ -321,6 +304,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.long("paging")
|
||||
.overrides_with("paging")
|
||||
.overrides_with("no-paging")
|
||||
.overrides_with("plain")
|
||||
.value_name("when")
|
||||
.value_parser(["auto", "never", "always"])
|
||||
.default_value("auto")
|
||||
@@ -393,40 +377,9 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
see all available themes. To set a default theme, add the \
|
||||
'--theme=\"...\"' option to the configuration file or export the \
|
||||
BAT_THEME environment variable (e.g.: export \
|
||||
BAT_THEME=\"...\").\n\n\
|
||||
Special values:\n\n \
|
||||
* auto: Picks a dark or light theme depending on the terminal's colors (default).\n \
|
||||
Use '--theme-light' and '--theme-dark' to customize the selected theme.\n \
|
||||
* auto:always: Detect the terminal's colors even when the output is redirected.\n \
|
||||
* auto:system: Detect the color scheme from the system-wide preference (macOS only).\n \
|
||||
* dark: Use the dark theme specified by '--theme-dark'.\n \
|
||||
* light: Use the light theme specified by '--theme-light'.",
|
||||
BAT_THEME=\"...\").",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("theme-light")
|
||||
.long("theme-light")
|
||||
.overrides_with("theme-light")
|
||||
.value_name("theme")
|
||||
.help("Sets the color theme for syntax highlighting used for light backgrounds.")
|
||||
.long_help(
|
||||
"Sets the theme name for syntax highlighting used when the terminal uses a light background. \
|
||||
Use '--list-themes' to see all available themes. To set a default theme, add the \
|
||||
'--theme-light=\"...\" option to the configuration file or export the BAT_THEME_LIGHT \
|
||||
environment variable (e.g. export BAT_THEME_LIGHT=\"...\")."),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("theme-dark")
|
||||
.long("theme-dark")
|
||||
.overrides_with("theme-dark")
|
||||
.value_name("theme")
|
||||
.help("Sets the color theme for syntax highlighting used for dark backgrounds.")
|
||||
.long_help(
|
||||
"Sets the theme name for syntax highlighting used when the terminal uses a dark background. \
|
||||
Use '--list-themes' to see all available themes. To set a default theme, add the \
|
||||
'--theme-dark=\"...\" option to the configuration file or export the BAT_THEME_DARK \
|
||||
environment variable (e.g. export BAT_THEME_DARK=\"...\")."),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("list-themes")
|
||||
.long("list-themes")
|
||||
@@ -434,45 +387,37 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.help("Display all supported highlighting themes.")
|
||||
.long_help("Display a list of supported themes for syntax highlighting."),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("squeeze-blank")
|
||||
.long("squeeze-blank")
|
||||
.short('s')
|
||||
.action(ArgAction::SetTrue)
|
||||
.help("Squeeze consecutive empty lines.")
|
||||
.long_help("Squeeze consecutive empty lines into a single empty line.")
|
||||
)
|
||||
.arg(
|
||||
Arg::new("squeeze-limit")
|
||||
.long("squeeze-limit")
|
||||
.value_parser(|s: &str| s.parse::<usize>().map_err(|_| "Requires a non-negative number".to_owned()))
|
||||
.long_help("Set the maximum number of consecutive empty lines to be printed.")
|
||||
.hide_short_help(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("strip-ansi")
|
||||
.long("strip-ansi")
|
||||
.overrides_with("strip-ansi")
|
||||
.value_name("when")
|
||||
.value_parser(["auto", "always", "never"])
|
||||
.default_value("never")
|
||||
.hide_default_value(true)
|
||||
.help("Strip colors from the input (auto, always, *never*)")
|
||||
.long_help("Specify when to strip ANSI escape sequences from the input. \
|
||||
The automatic mode will remove escape sequences unless the syntax highlighting \
|
||||
language is plain text. Possible values: auto, always, *never*.")
|
||||
.hide_short_help(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("style")
|
||||
.long("style")
|
||||
.action(ArgAction::Append)
|
||||
.value_name("components")
|
||||
.overrides_with("style")
|
||||
.overrides_with("plain")
|
||||
.overrides_with("number")
|
||||
// Cannot use claps built in validation because we have to turn off clap's delimiters
|
||||
.value_parser(|val: &str| {
|
||||
match StyleComponentList::from_str(val) {
|
||||
Err(err) => Err(err),
|
||||
Ok(_) => Ok(val.to_owned()),
|
||||
let mut invalid_vals = val.split(',').filter(|style| {
|
||||
!&[
|
||||
"auto",
|
||||
"full",
|
||||
"default",
|
||||
"plain",
|
||||
"header",
|
||||
"header-filename",
|
||||
"header-filesize",
|
||||
"grid",
|
||||
"rule",
|
||||
"numbers",
|
||||
"snip",
|
||||
#[cfg(feature = "git")]
|
||||
"changes",
|
||||
].contains(style)
|
||||
});
|
||||
|
||||
if let Some(invalid) = invalid_vals.next() {
|
||||
Err(format!("Unknown style, '{}'", invalid))
|
||||
} else {
|
||||
Ok(val.to_owned())
|
||||
}
|
||||
})
|
||||
.help(
|
||||
@@ -487,14 +432,6 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
pre-defined style ('full'). To set a default style, add the \
|
||||
'--style=\"..\"' option to the configuration file or export the \
|
||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
||||
When styles are specified in multiple places, the \"nearest\" set \
|
||||
of styles take precedence. The command-line arguments are the highest \
|
||||
priority, followed by the BAT_STYLE environment variable, and then \
|
||||
the configuration file. If any set of styles consists entirely of \
|
||||
components prefixed with \"+\" or \"-\", it will modify the \
|
||||
previous set of styles instead of replacing them.\n\n\
|
||||
By default, the following components are enabled:\n \
|
||||
changes, grid, header-filename, numbers, snip\n\n\
|
||||
Possible values:\n\n \
|
||||
* default: enables recommended style components (default).\n \
|
||||
* full: enables all available components.\n \
|
||||
@@ -525,9 +462,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
'--line-range :40' prints lines 1 to 40\n \
|
||||
'--line-range 40:' prints lines 40 to the end of the file\n \
|
||||
'--line-range 40' only prints line 40\n \
|
||||
'--line-range 30:+10' prints lines 30 to 40\n \
|
||||
'--line-range 35::5' prints lines 30 to 40 (line 35 with 5 lines of context)\n \
|
||||
'--line-range 30:40:2' prints lines 28 to 42 (range 30-40 with 2 lines of context)",
|
||||
'--line-range 30:+10' prints lines 30 to 40",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
@@ -566,17 +501,6 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.help("Do not load custom assets"),
|
||||
);
|
||||
|
||||
#[cfg(feature = "application")]
|
||||
{
|
||||
app = app.arg(
|
||||
Arg::new("completion")
|
||||
.long("completion")
|
||||
.value_name("SHELL")
|
||||
.value_parser(["bash", "fish", "ps1", "zsh"])
|
||||
.help("Show shell completion for a certain shell. [possible values: bash, fish, zsh, ps1]"),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "lessopen")]
|
||||
{
|
||||
app = app
|
||||
@@ -643,13 +567,6 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.action(ArgAction::SetTrue)
|
||||
.hide_short_help(true)
|
||||
.help("Show acknowledgements."),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("set-terminal-title")
|
||||
.long("set-terminal-title")
|
||||
.action(ArgAction::SetTrue)
|
||||
.hide_short_help(true)
|
||||
.help("Sets terminal title to filenames when using a pager."),
|
||||
);
|
||||
|
||||
// Check if the current directory contains a file name cache. Otherwise,
|
||||
|
@@ -1,6 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
pub const BASH_COMPLETION: &str = include_str!(env!("BAT_GENERATED_COMPLETION_BASH"));
|
||||
pub const FISH_COMPLETION: &str = include_str!(env!("BAT_GENERATED_COMPLETION_FISH"));
|
||||
pub const PS1_COMPLETION: &str = include_str!(env!("BAT_GENERATED_COMPLETION_PS1"));
|
||||
pub const ZSH_COMPLETION: &str = include_str!(env!("BAT_GENERATED_COMPLETION_ZSH"));
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user