mirror of
https://github.com/sharkdp/bat
synced 2026-08-03 18:51:44 +00:00
Compare commits
257 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6258dda0f8 | |||
| e6565b2134 | |||
| 2f9ecf9044 | |||
| a74d35582e | |||
| 8886faa019 | |||
| 4bd1b157ae | |||
| 1ecb70e082 | |||
| 9eed16beb4 | |||
| c432a064a4 | |||
| 2d1a92b7cc | |||
| cb31127b32 | |||
| 2beec1f3ea | |||
| 8d531b6436 | |||
| 30993a8bfc | |||
| 2258fb2713 | |||
| a46191b8bf | |||
| 9c4c3e965b | |||
| 31acbe20d3 | |||
| fd52c01e78 | |||
| 6ca5543648 | |||
| 83afcdcf49 | |||
| 59ca0069a6 | |||
| 6d6184500e | |||
| 1c24ec16e2 | |||
| 5efc0033a1 | |||
| c9237cccab | |||
| 02cd68db37 | |||
| e4df5643dc | |||
| 89b62d579f | |||
| 436a16aba6 | |||
| 32d22f464d | |||
| 71b2089384 | |||
| 57aa88a13a | |||
| 5ef35a10cf | |||
| f84aceec3d | |||
| f18009e5d5 | |||
| 83c7750656 | |||
| c477e23fe9 | |||
| 31fb7087f1 | |||
| 6bc477e88f | |||
| 52d6701f8f | |||
| f97634011e | |||
| a4ffc9d5ed | |||
| a86f3e5b81 | |||
| d9e8bbcb10 | |||
| 8b0886ac32 | |||
| aa182dad76 | |||
| 41a1952928 | |||
| 9885d4ebf0 | |||
| 222e080ce7 | |||
| 046409d7c9 | |||
| 5df449bcf3 | |||
| 6017989c4c | |||
| d349974089 | |||
| ccdea6a429 | |||
| fdf11326ef | |||
| 565a80305c | |||
| 57a8122a6b | |||
| bc5517da78 | |||
| ad18f070ae | |||
| e305402212 | |||
| d62b99f543 | |||
| 4d8133eb34 | |||
| 5cba5b9989 | |||
| 31f23123ef | |||
| b9dac6ca5d | |||
| c3f85c8372 | |||
| 7f5d6d9791 | |||
| 96d4cdb7cb | |||
| 9f1f3ab5e3 | |||
| 6e90f17a15 | |||
| 5b654480f4 | |||
| 803447e2a1 | |||
| 99c04a8740 | |||
| e4370d8d3f | |||
| 883cc964ae | |||
| 1d4cee11b7 | |||
| 9f91a7d797 | |||
| 4a6b4fb632 | |||
| 7c730d11c3 | |||
| 21de52ebea | |||
| cab5ddf6ae | |||
| b3657aef2b | |||
| b0f8841217 | |||
| febe335831 | |||
| cbe68ba84c | |||
| 9110b00e2e | |||
| 4b012de7db | |||
| 49370e2175 | |||
| 02a89d8ee8 | |||
| a70efae79b | |||
| 78a681f027 | |||
| 3a85fd767b | |||
| 2ffbe08eb1 | |||
| f9d5e81f0e | |||
| 00d1267bdd | |||
| 001ee34d01 | |||
| db157567fd | |||
| 9e0fab16ff | |||
| a9af4f4ca1 | |||
| 96d682ca49 | |||
| 7056bea9e0 | |||
| 63e13d8e54 | |||
| 81587b3578 | |||
| 663c7cf1d7 | |||
| 8705d018fd | |||
| 8c33a32256 | |||
| 37a720be06 | |||
| aacbdcfc44 | |||
| 794f3d08f4 | |||
| 3147f0536a | |||
| 42de486e94 | |||
| 54c9d7cdb2 | |||
| c8e394f3f0 | |||
| 4b65e6e443 | |||
| 5a6c65c589 | |||
| 75246fb25b | |||
| 0cc1084819 | |||
| 21eedaf76e | |||
| 2656c503a4 | |||
| 2b3457e8d6 | |||
| f5d606c4fc | |||
| 0e38c1728e | |||
| 6faf61552e | |||
| fcf5ec2f77 | |||
| 99819087f1 | |||
| 3956e96e74 | |||
| a0b89a68d9 | |||
| 62014c1094 | |||
| 58dcabffe6 | |||
| c264f74771 | |||
| f53ea60ed4 | |||
| 05027b7c74 | |||
| 3a62e3d188 | |||
| 963d9ee584 | |||
| 12e4fd138b | |||
| 3c5ce9f86c | |||
| 2461d22212 | |||
| 611c6e9c74 | |||
| 38efdb5148 | |||
| 5fdeeabb44 | |||
| b0d19752c6 | |||
| a95a577622 | |||
| ca44a80a42 | |||
| bf841e63bd | |||
| d357227e57 | |||
| 993d703ba0 | |||
| b449b82191 | |||
| bfac6fd85c | |||
| 2575aae945 | |||
| b0191cdf2c | |||
| fc121f0c87 | |||
| fa10b48c71 | |||
| d4db1c6af3 | |||
| f651e2cfca | |||
| 9d9f99c2d1 | |||
| 9c8dda1f9d | |||
| 89521a5134 | |||
| d11355f985 | |||
| 7ccda6e6e9 | |||
| 1de423c78b | |||
| 3943857087 | |||
| 27bb5c5976 | |||
| 3f614cb274 | |||
| 1e407d972f | |||
| 52b3c5fce4 | |||
| 5d53273ef4 | |||
| bf9faa9c28 | |||
| 0356b7f2c3 | |||
| 19c8558152 | |||
| a137db86a4 | |||
| 2a28f04e09 | |||
| 8dfa69fde4 | |||
| 541f014d50 | |||
| 233d375983 | |||
| b09d245dea | |||
| 44deddbbfe | |||
| aa8a2b1769 | |||
| 4cdac180d8 | |||
| d079bf86b1 | |||
| 62b4452057 | |||
| c3ec92a13f | |||
| c3230a68bb | |||
| d9f163f466 | |||
| d0da5af810 | |||
| a2b2ec467a | |||
| 83b3009f0f | |||
| 4ea70f8409 | |||
| 0d2ef02c9e | |||
| 2d7796284b | |||
| 19aa878a08 | |||
| 9f52012443 | |||
| e57e9b6dbb | |||
| 74e8373e34 | |||
| ec2722d465 | |||
| 9e2ea5fdd4 | |||
| 48b4a6a906 | |||
| 92e93682c6 | |||
| 99226b745f | |||
| 4840c7cd78 | |||
| 71ab4a2058 | |||
| a2c09b41bc | |||
| 0ef792ac1e | |||
| 01af28b781 | |||
| 3a7743ffc5 | |||
| 9cc8e52512 | |||
| 698a6b5acf | |||
| 7a51c7fd30 | |||
| 7c3e9f81cb | |||
| 6e3e7dafca | |||
| fca83bf79a | |||
| b8ffb8d463 | |||
| 1dae5bbc95 | |||
| 1a1932b67a | |||
| 8be375e75b | |||
| e63e4232db | |||
| cef04665eb | |||
| 76569b9527 | |||
| 1d46eb8ea3 | |||
| 6b79ac995e | |||
| ee928b034e | |||
| fc5790eb4a | |||
| 5213ffee0e | |||
| 5ebf0215c5 | |||
| 9957da6b93 | |||
| 342cae2dc6 | |||
| d2b26a5f1f | |||
| 9d08c0102e | |||
| a3357547ea | |||
| 7a9decad70 | |||
| c4d0d068e4 | |||
| c03a027240 | |||
| a8d7141c4c | |||
| 3eb704e016 | |||
| 0f06d3b90d | |||
| 589c94aa93 | |||
| 798b742617 | |||
| 11a72ab765 | |||
| 0319149b4d | |||
| 2f823d59b0 | |||
| 981352992b | |||
| 384ea38bd9 | |||
| 268c0963b4 | |||
| 8b481dd41f | |||
| 6f88ba0e6f | |||
| 9e65ecd03e | |||
| 9cb43ef64d | |||
| bb18ece8a4 | |||
| 2ab6474761 | |||
| fe20328ab7 | |||
| d84ac09abd | |||
| 69e6cae0a7 | |||
| 302707f3ce | |||
| 2e2043971b | |||
| e54e218e3b | |||
| bd17fd571f | |||
| 3f6e88b4be |
@@ -0,0 +1 @@
|
||||
comment: false
|
||||
@@ -0,0 +1,456 @@
|
||||
name: CICD
|
||||
|
||||
env:
|
||||
PROJECT_NAME: bat
|
||||
PROJECT_DESC: "A `cat` clone with wings"
|
||||
PROJECT_MAINTAINER: "David Peter <mail@david-peter.de>"
|
||||
PROJECT_HOMEPAGE: "https://github.com/sharkdp/bat"
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.40.0"
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
min_version:
|
||||
name: Minimum supported rust version
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
||||
default: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
- name: Test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
|
||||
test_with_new_syntaxes_and_themes:
|
||||
name: Test with new syntaxes and themes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true # we need all syntax and theme submodules
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
default: true
|
||||
profile: minimal
|
||||
- name: Build and install bat
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: install
|
||||
args: --locked --path .
|
||||
- name: Rebuild binary assets (syntaxes and themes)
|
||||
run: bash assets/create.sh
|
||||
- name: Build and install bat with updated assets
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: install
|
||||
args: --locked --path .
|
||||
- name: Run unit tests with new syntaxes and themes
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --release
|
||||
- name: Syntax highlighting regression test
|
||||
run: tests/syntax-tests/regression_test.sh
|
||||
- name: List of languages
|
||||
run: bat --list-languages
|
||||
- name: List of themes
|
||||
run: bat --list-themes
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
job:
|
||||
# { os, target, cargo-options, features, use-cross, toolchain }
|
||||
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , use-cross: use-cross }
|
||||
- { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: use-cross }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: use-cross }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: use-cross }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu , use-cross: use-cross }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: use-cross }
|
||||
- { os: ubuntu-16.04 , target: x86_64-unknown-linux-gnu , use-cross: use-cross }
|
||||
- { os: macos-latest , target: x86_64-apple-darwin }
|
||||
# - { os: windows-latest , target: i686-pc-windows-gnu } ## disabled; linker errors (missing '_imp____acrt_iob_func')
|
||||
- { os: windows-latest , target: i686-pc-windows-msvc }
|
||||
# - { os: windows-latest , target: x86_64-pc-windows-gnu } ## disabled; linker errors (missing '_imp____acrt_iob_func')
|
||||
- { os: windows-latest , target: x86_64-pc-windows-msvc }
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Install prerequisites
|
||||
shell: bash
|
||||
run: |
|
||||
case ${{ matrix.job.target }} in
|
||||
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
||||
esac
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
# toolchain
|
||||
TOOLCHAIN="stable" ## default to "stable" toolchain
|
||||
# * specify alternate TOOLCHAIN for *-pc-windows-gnu targets; gnu targets on Windows are broken for the standard *-pc-windows-msvc toolchain (refs: <https://github.com/rust-lang/rust/issues/47048>, <https://github.com/rust-lang/rust/issues/53454>, <https://github.com/rust-lang/cargo/issues/6754>)
|
||||
case ${{ matrix.job.target }} in *-pc-windows-gnu) TOOLCHAIN="stable-${{ matrix.job.target }}" ;; esac;
|
||||
# * use requested TOOLCHAIN if specified
|
||||
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||
echo set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||
echo ::set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||
# staging directory
|
||||
STAGING='_staging'
|
||||
echo set-output name=STAGING::${STAGING}
|
||||
echo ::set-output name=STAGING::${STAGING}
|
||||
# determine EXE suffix
|
||||
EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
|
||||
echo set-output name=EXE_suffix::${EXE_suffix}
|
||||
echo ::set-output name=EXE_suffix::${EXE_suffix}
|
||||
# parse commit reference info
|
||||
REF_NAME=${GITHUB_REF#refs/*/}
|
||||
unset REF_BRANCH ; case ${GITHUB_REF} in refs/heads/*) REF_BRANCH=${GITHUB_REF#refs/heads/} ;; esac;
|
||||
unset REF_TAG ; case ${GITHUB_REF} in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac;
|
||||
REF_SHAS=${GITHUB_SHA:0:8}
|
||||
echo set-output name=REF_NAME::${REF_NAME}
|
||||
echo set-output name=REF_BRANCH::${REF_BRANCH}
|
||||
echo set-output name=REF_TAG::${REF_TAG}
|
||||
echo set-output name=REF_SHAS::${REF_SHAS}
|
||||
echo ::set-output name=REF_NAME::${REF_NAME}
|
||||
echo ::set-output name=REF_BRANCH::${REF_BRANCH}
|
||||
echo ::set-output name=REF_TAG::${REF_TAG}
|
||||
echo ::set-output name=REF_SHAS::${REF_SHAS}
|
||||
# parse target
|
||||
unset TARGET_ARCH ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) TARGET_ARCH=arm ;; i686-*) TARGET_ARCH=i686 ;; x86_64-*) TARGET_ARCH=x86_64 ;; esac;
|
||||
echo set-output name=TARGET_ARCH::${TARGET_ARCH}
|
||||
echo ::set-output name=TARGET_ARCH::${TARGET_ARCH}
|
||||
unset TARGET_OS ; case ${{ matrix.job.target }} in *-linux-*) TARGET_OS=linux ;; *-apple-*) TARGET_OS=macos ;; *-windows-*) TARGET_OS=windows ;; esac;
|
||||
echo set-output name=TARGET_OS::${TARGET_OS}
|
||||
echo ::set-output name=TARGET_OS::${TARGET_OS}
|
||||
# package name
|
||||
PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
|
||||
PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }}
|
||||
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
|
||||
echo set-output name=PKG_suffix::${PKG_suffix}
|
||||
echo set-output name=PKG_BASENAME::${PKG_BASENAME}
|
||||
echo set-output name=PKG_NAME::${PKG_NAME}
|
||||
echo ::set-output name=PKG_suffix::${PKG_suffix}
|
||||
echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
|
||||
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
||||
# deployable tag? (ie, leading "vM" or "M"; M == version number)
|
||||
unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi
|
||||
echo set-output name=DEPLOY::${DEPLOY:-<empty>/false}
|
||||
echo ::set-output name=DEPLOY::${DEPLOY}
|
||||
# DPKG architecture?
|
||||
unset DPKG_ARCH
|
||||
case ${{ matrix.job.target }} in
|
||||
aarch64-*-linux-*) DPKG_ARCH=arm64 ;;
|
||||
arm-*-linux-*hf) DPKG_ARCH=armhf ;;
|
||||
i686-*-linux-*) DPKG_ARCH=i686 ;;
|
||||
x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
|
||||
esac;
|
||||
echo set-output name=DPKG_ARCH::${DPKG_ARCH}
|
||||
echo ::set-output name=DPKG_ARCH::${DPKG_ARCH}
|
||||
# DPKG version?
|
||||
unset DPKG_VERSION ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DPKG_VERSION=${REF_TAG/#[vV]/} ; fi
|
||||
echo set-output name=DPKG_VERSION::${DPKG_VERSION}
|
||||
echo ::set-output name=DPKG_VERSION::${DPKG_VERSION}
|
||||
# DPKG base name/conflicts?
|
||||
DPKG_BASENAME=${PROJECT_NAME}
|
||||
DPKG_CONFLICTS=${PROJECT_NAME}-musl
|
||||
case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac;
|
||||
echo set-output name=DPKG_BASENAME::${DPKG_BASENAME}
|
||||
echo set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS}
|
||||
echo ::set-output name=DPKG_BASENAME::${DPKG_BASENAME}
|
||||
echo ::set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS}
|
||||
# DPKG name
|
||||
unset DPKG_NAME;
|
||||
if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi
|
||||
echo set-output name=DPKG_NAME::${DPKG_NAME}
|
||||
echo ::set-output name=DPKG_NAME::${DPKG_NAME}
|
||||
# target-specific options
|
||||
# * CARGO_USE_CROSS (truthy)
|
||||
CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac;
|
||||
echo set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS:-<empty>/false}
|
||||
echo ::set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS}
|
||||
# # * `arm` cannot be tested on ubuntu-* hosts (b/c testing is currently primarily done via comparison of target outputs with built-in outputs and the `arm` target is not executable on the host)
|
||||
JOB_DO_TESTING="true"
|
||||
case ${{ matrix.job.target }} in arm-*) unset JOB_DO_TESTING ;; esac;
|
||||
echo set-output name=JOB_DO_TESTING::${JOB_DO_TESTING:-<empty>/false}
|
||||
echo ::set-output name=JOB_DO_TESTING::${JOB_DO_TESTING}
|
||||
# # * test only library unit tests and binary for arm-type targets
|
||||
unset CARGO_TEST_OPTIONS
|
||||
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
|
||||
echo set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
||||
echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
|
||||
# * executable for `strip`?
|
||||
STRIP="strip" ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; *-pc-windows-msvc) STRIP="" ;; esac;
|
||||
echo set-output name=STRIP::${STRIP}
|
||||
echo ::set-output name=STRIP::${STRIP}
|
||||
- name: Create all needed build/work directories
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p '${{ steps.vars.outputs.STAGING }}'
|
||||
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}'
|
||||
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/autocomplete'
|
||||
mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg'
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
|
||||
target: ${{ matrix.job.target }}
|
||||
override: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
- name: Info
|
||||
shell: bash
|
||||
run: |
|
||||
gcc --version || true
|
||||
rustup -V
|
||||
rustup toolchain list
|
||||
rustup default
|
||||
cargo -V
|
||||
rustc -V
|
||||
- name: Build
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: build
|
||||
args: --release --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }}
|
||||
- name: Test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: test
|
||||
args: --target=${{ matrix.job.target }} ${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }}
|
||||
- name: bat test run
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: run
|
||||
args: --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} -- --paging=never --color=always --theme=ansi-dark Cargo.toml src/config.rs
|
||||
- name: Check features regex-onig
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||
- name: Check features regex-onig,git
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||
- name: Check features regex-onig,paging
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||
- name: Check features regex-onig,git,paging
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
|
||||
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
|
||||
- name: Package
|
||||
shell: bash
|
||||
run: |
|
||||
ARCHIVE_DIR='${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/'
|
||||
COPYRIGHT_YEARS="2018 - "$(date "+%Y")
|
||||
# Binary
|
||||
cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "$ARCHIVE_DIR"
|
||||
|
||||
# `strip` binary (if needed)
|
||||
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "$ARCHIVE_DIR/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
||||
|
||||
# Man page
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "$ARCHIVE_DIR"
|
||||
|
||||
# README, LICENSE and CHANGELOG files
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
||||
|
||||
# Autocompletion files
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.zsh"
|
||||
|
||||
# base compressed package
|
||||
pushd '${{ steps.vars.outputs.STAGING }}/' >/dev/null
|
||||
case ${{ matrix.job.target }} in
|
||||
*-pc-windows-*) 7z -y a '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* | tail -2 ;;
|
||||
*) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
|
||||
esac;
|
||||
popd >/dev/null
|
||||
|
||||
# Debian package
|
||||
if [ -n "${{ steps.vars.outputs.DPKG_NAME }}" ]; then
|
||||
DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg"
|
||||
|
||||
# Binary
|
||||
install -Dm755 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}"
|
||||
if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then "${{ steps.vars.outputs.STRIP }}" "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}" ; fi
|
||||
|
||||
# Work out shared library dependencies
|
||||
# dpkg-shlibdeps requires debian/control file. Dummy it and clean up
|
||||
mkdir "./debian"
|
||||
touch "./debian/control"
|
||||
case ${{ matrix.job.target }} in
|
||||
aarch64-*-linux-*) DEPENDS="$(dpkg-shlibdeps -l/usr/aarch64-linux-gnu/lib -O "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}" 2> /dev/null | sed 's/^shlibs:Depends=//')" ;;
|
||||
arm-*-linux-*hf) DEPENDS="$(dpkg-shlibdeps -l/usr/arm-linux-gnueabihf/lib -O "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}" 2> /dev/null | sed 's/^shlibs:Depends=//')" ;;
|
||||
i686-*-linux-*) DEPENDS="$(dpkg-shlibdeps -O "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}" 2> /dev/null | sed 's/^shlibs:Depends=//')" ;;
|
||||
x86_64-*-linux-*) DEPENDS="$(dpkg-shlibdeps -O "${DPKG_DIR}/usr/bin/${{ env.PROJECT_NAME }}" 2> /dev/null | sed 's/^shlibs:Depends=//')" ;;
|
||||
esac;
|
||||
rm -rf "./debian"
|
||||
|
||||
# Man page
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
|
||||
# Autocompletion files
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ env.PROJECT_NAME }}.fish"
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.zsh "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ env.PROJECT_NAME }}"
|
||||
|
||||
# README and LICENSE
|
||||
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-MIT"
|
||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/LICENSE-APACHE"
|
||||
install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
||||
gzip -n --best "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/changelog"
|
||||
|
||||
cat > "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright" <<EOF
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: ${{ env.PROJECT_NAME }}
|
||||
Source: ${{ env.PROJECT_HOMEPAGE }}
|
||||
|
||||
Files: *
|
||||
Copyright: ${{ env.PROJECT_MAINTAINER }}
|
||||
Copyright: $COPYRIGHT_YEARS ${{ env.PROJECT_MAINTAINER }}
|
||||
License: Apache-2.0 or MIT
|
||||
|
||||
License: Apache-2.0
|
||||
On Debian systems, the complete text of the Apache-2.0 can be found in the
|
||||
file /usr/share/common-licenses/Apache-2.0.
|
||||
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
EOF
|
||||
chmod 644 "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright"
|
||||
|
||||
# control file
|
||||
mkdir -p "${DPKG_DIR}/DEBIAN"
|
||||
cat > "${DPKG_DIR}/DEBIAN/control" <<EOF
|
||||
Package: ${{ steps.vars.outputs.DPKG_BASENAME }}
|
||||
Version: ${{ steps.vars.outputs.DPKG_VERSION }}
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: ${{ env.PROJECT_MAINTAINER }}
|
||||
Homepage: ${{ env.PROJECT_HOMEPAGE }}
|
||||
Architecture: ${{ steps.vars.outputs.DPKG_ARCH }}
|
||||
Depends: $DEPENDS
|
||||
Provides: ${{ env.PROJECT_NAME }}
|
||||
Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }}
|
||||
Description: cat(1) clone with wings.
|
||||
A cat(1) clone with syntax highlighting and Git integration.
|
||||
EOF
|
||||
|
||||
# build dpkg
|
||||
fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
|
||||
fi
|
||||
- name: Publish archives and packages
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.vars.outputs.DEPLOY
|
||||
with:
|
||||
files: |
|
||||
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
|
||||
${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
coverage:
|
||||
name: Code Coverage
|
||||
runs-on: ${{ matrix.job.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
# job: [ { os: ubuntu-latest }, { os: macos-latest }, { os: windows-latest } ]
|
||||
job:
|
||||
- { os: ubuntu-latest , toolchain: nightly-2020-04-29 }
|
||||
- { os: macos-latest , toolchain: nightly-2020-04-29 }
|
||||
- { os: windows-latest , toolchain: nightly-2020-04-29-x86_64-pc-windows-gnu }
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
# toolchain
|
||||
TOOLCHAIN="nightly" ## default to "nightly" toolchain
|
||||
# * use requested TOOLCHAIN if specified
|
||||
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||
# * use requested TOOLCHAIN if specified
|
||||
if [ -n "${{ matrix.job.toolchain }}" ]; then TOOLCHAIN="${{ matrix.job.toolchain }}" ; fi
|
||||
echo set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||
echo ::set-output name=TOOLCHAIN::${TOOLCHAIN}
|
||||
# target-specific options
|
||||
# * CODECOV_FLAGS
|
||||
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
|
||||
echo set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
|
||||
echo ::set-output name=CODECOV_FLAGS::${CODECOV_FLAGS}
|
||||
- name: rust toolchain ~ install
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
|
||||
override: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
- name: Test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --no-fail-fast
|
||||
env:
|
||||
CARGO_INCREMENTAL: '0'
|
||||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads'
|
||||
- name: Generate coverage data
|
||||
id: coverage
|
||||
uses: actions-rs/grcov@v0.1
|
||||
- name: Upload coverage results (to Codecov.io)
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: ${{ steps.coverage.outputs.report }}
|
||||
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
@@ -3,5 +3,6 @@
|
||||
|
||||
# Generated files
|
||||
/assets/completions/bat.fish
|
||||
/assets/completions/bat.zsh
|
||||
/assets/manual/bat.1
|
||||
/assets/metadata.yaml
|
||||
|
||||
+15
-6
@@ -70,9 +70,6 @@
|
||||
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||
path = assets/syntaxes/02_Extra/JavaScript (Babel)
|
||||
url = https://github.com/babel/babel-sublime
|
||||
[submodule "assets/syntaxes/Cabal"]
|
||||
path = assets/syntaxes/02_Extra/Cabal
|
||||
url = https://github.com/SublimeHaskell/SublimeHaskell
|
||||
[submodule "assets/syntaxes/Dart"]
|
||||
path = assets/syntaxes/02_Extra/Dart
|
||||
url = https://github.com/guillermooo/dart-sublime-bundle
|
||||
@@ -97,9 +94,6 @@
|
||||
[submodule "assets/themes/sublime-snazzy"]
|
||||
path = assets/themes/sublime-snazzy
|
||||
url = https://github.com/greggb/sublime-snazzy
|
||||
[submodule "assets/syntaxes/AsciiDoc"]
|
||||
path = assets/syntaxes/02_Extra/AsciiDoc
|
||||
url = https://github.com/SublimeText/AsciiDoc.git
|
||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||
@@ -188,3 +182,18 @@
|
||||
[submodule "assets/syntaxes/02_Extra/QML"]
|
||||
path = assets/syntaxes/02_Extra/QML
|
||||
url = https://github.com/skozlovf/Sublime-QML
|
||||
[submodule "assets/syntaxes/02_Extra/AsciiDoc"]
|
||||
path = assets/syntaxes/02_Extra/AsciiDoc
|
||||
url = https://github.com/asciidoctor/sublimetext-asciidoc.git
|
||||
[submodule "assets/themes/gruvbox"]
|
||||
path = assets/themes/gruvbox
|
||||
url = https://github.com/peaceant/gruvbox.git
|
||||
[submodule "assets/syntaxes/02_Extra/GLSL"]
|
||||
path = assets/syntaxes/02_Extra/GLSL
|
||||
url = https://github.com/euler0/sublime-glsl
|
||||
[submodule "assets/syntaxes/02_Extra/Nginx"]
|
||||
path = assets/syntaxes/02_Extra/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
|
||||
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
language: rust
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Stable channel.
|
||||
- os: linux
|
||||
rust: stable
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
- os: linux
|
||||
rust: stable
|
||||
env:
|
||||
- TARGET=x86_64-unknown-linux-musl
|
||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
||||
- os: linux
|
||||
rust: stable
|
||||
env: TARGET=i686-unknown-linux-gnu
|
||||
- os: osx
|
||||
rust: stable
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
- os: linux
|
||||
rust: stable
|
||||
env:
|
||||
- TARGET=arm-unknown-linux-gnueabihf
|
||||
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
||||
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
||||
- os: linux
|
||||
rust: stable
|
||||
env:
|
||||
- TARGET=aarch64-unknown-linux-gnu
|
||||
- CC_aarch64-unknown-linux-gnu=/usr/bin/aarch64-linux-gnu-gcc-4.8
|
||||
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-4.8
|
||||
|
||||
# Minimum Rust supported channel.
|
||||
- os: linux
|
||||
rust: 1.40.0
|
||||
env: TARGET=x86_64-unknown-linux-gnu
|
||||
- os: linux
|
||||
rust: 1.40.0
|
||||
env:
|
||||
- TARGET=x86_64-unknown-linux-musl
|
||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
||||
- os: osx
|
||||
rust: 1.40.0
|
||||
env: TARGET=x86_64-apple-darwin
|
||||
|
||||
# Disable nightly for now
|
||||
# # Code formatting check
|
||||
# - os: linux
|
||||
# rust: nightly
|
||||
# # skip the global install step
|
||||
# install:
|
||||
# - cargo install --debug --force rustfmt-nightly
|
||||
# script: cargo fmt -- --check
|
||||
|
||||
sudo: required
|
||||
|
||||
before_install:
|
||||
- ci/before_install.bash
|
||||
|
||||
env:
|
||||
global:
|
||||
# Default target on travis-ci.
|
||||
# Used as conditional check in the install stage
|
||||
- HOST=x86_64-unknown-linux-gnu
|
||||
# Used on the deployment script
|
||||
- PROJECT_NAME=bat
|
||||
|
||||
install:
|
||||
# prevent target re-add error from rustup
|
||||
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
|
||||
|
||||
script:
|
||||
- ci/script.bash
|
||||
|
||||
before_deploy:
|
||||
- bash ci/before_deploy.bash
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
# NOTE updating the `api_key.secure`
|
||||
# - go to: https://github.com/settings/tokens/new
|
||||
# - generate new token using `public_repo` scope
|
||||
# - encrypt it using: `travis encrypt API_KEY_HERE`
|
||||
# - paste the output below
|
||||
api_key:
|
||||
secure: "GZL8nYk+/MZGEqejpP0UMMGVmwUEdxiF9CflFIGccu+/tznDyHnHOpyJmbH3M5IKWIxa7xFgqOE8pHuD4oQXt4mzyJGB0KMKKEFLW7ckbTYKya5bw0heKznaqGnS0Yz+vpfqYR25eiPFYCz7mDsGsCzH5QZqt3cdn9MDQGu1D0IaxPjuBNH3T9kBblR0ifBd3Diy0JYhiVcMSI3V1rkel18F1yBHO2GQ95hkWxVgjANQnefq5+zdzbx4ki539ewYENShA8N0w6ULJVY9LmWRWJIp90ggOD3JCH6Nz/fBpYBqwfABO6Dr7Csw7IRm7pM4IVkFZS1taiDYFX9thxZh3UTmI4YYtSTPxH9NGV47kxPipbf4vAXFwW+1VcHKMpBzz+5IVsHnk1Pfx9/GZsXbqXM3PUWCStec36Xtqh5vQapDKEg9khkEs4b1X7/E73gvpRuQl9gbnyufSVWgDsXIWqM+0aDbqQz1FpLmVxz6eij0cB9vR+8kbNoe/CEPHPO9ZllvAHseukOeHPzSBd8rILORXaaGmQausXz2wWgSsffUSYz4705P8joI0zFCfmkHjL+kA1ZUx5SxLCc1ID7CFFZChhAxHoPL7xc21snswwr8QeheERdwvuzKNaerBGZEw8dmMMx98YkjftIj65DDySr2mRZuufBQeQpmMhFyIT4="
|
||||
# for uploading multiple files
|
||||
file_glob: true
|
||||
# NOTE explanation on each env variable
|
||||
# - PROJECT_NAME: name of the project, set on the `env.global` above
|
||||
# - TRAVIS_TAG: tag name that the build is being deployed for, usually the version number
|
||||
# - TARGET: target triple of the build
|
||||
file:
|
||||
- $PROJECT_NAME-$TRAVIS_TAG-$TARGET.*
|
||||
- $PROJECT_NAME*.deb
|
||||
# don't delete artifacts from previous stage
|
||||
skip_cleanup: true
|
||||
on:
|
||||
# deploy only if we push a tag
|
||||
tags: true
|
||||
# deploy only on stable channel that has TARGET env variable sets
|
||||
condition: $TRAVIS_RUST_VERSION = stable && $TARGET != ""
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
+73
-9
@@ -1,32 +1,96 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
|
||||
## Bugfixes
|
||||
|
||||
## Other
|
||||
## New syntaxes
|
||||
|
||||
## Syntaxes
|
||||
|
||||
## New themes
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
## Packaging
|
||||
|
||||
# v0.15.2
|
||||
# v0.16.0
|
||||
|
||||
## Features
|
||||
|
||||
- Added support for the `NO_COLOR` environment variable, see #1021 and #1031 (@eth-p)
|
||||
- Added `-P` short flag to disable paging, see #1075 and #1082 (@LordFlashmeow)
|
||||
- Added `--force-colorization`/`-f` flag to provide an alias for forced color and decoration output, see #1141 (@alexanderkarlis)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- bat mishighlights Users that start with digits in SSH config, see #984
|
||||
- `--map-syntax` doesn't work with names provided through `--file-name` (@eth-p)
|
||||
- Fix syntax detection for files called 'rails', see #1008
|
||||
- Fix potential errors with syntax detection for symlinked files, see #1001
|
||||
- Fixed non-printable characters display for redirected output, see #1061 (@gsomix)
|
||||
- Handle file extension conflicts in `--list-languages`, see #1076 and #1135 (@Kienyew)
|
||||
|
||||
## Other
|
||||
|
||||
- Add padding above headers when not using a grid, see #968 and #981 (@pt2121)
|
||||
- bat now prints an error if an invalid syntax is specified via `-l` or `--map-syntax`, see #1004 (@eth-p)
|
||||
- Switched to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet for non-printing spaces, see #1056 and #1100 (@LordFlashmeow)
|
||||
- Added zsh shell completion script, see #1136 (@Kienyew)
|
||||
- Improved `--help` text (@sharkdp)
|
||||
- Added custom languages/themes sections to manpage (@eth-p)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Update AsciiDoc syntax, see #1034 (@rxt1077)
|
||||
- GLSL (@caioalonso)
|
||||
- Add Nginx and Apache config file syntax, see #1137 (@kjmph, @niklasmohrin)
|
||||
- Use `fstab` syntax for `crypttab` files, see #1073 (@sharkdp)
|
||||
- Support syntax highlighting for files in `$XDG_CONFIG_HOME/git/`, see #1191 (@ahmedelgabri)
|
||||
|
||||
## New themes
|
||||
|
||||
- Gruvbox, see #1069 (@kyleondy)
|
||||
- base16-256 for [base16-shell](https://github.com/chriskempson/base16-shell) users, see #1111 (@mk12)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
- Add APIs to provide `Input` descriptions with `InputDescription` (@eth-p)
|
||||
- Add function to directly provide `Input`s to `PrettyPrinter` (@eth-p)
|
||||
- **Breaking:** `Input::theme_preview_file` is no longer available. (@eth-p)
|
||||
|
||||
## Packaging
|
||||
|
||||
- Removed build dependency on `liquid` (@sharkdp).
|
||||
|
||||
# v0.15.4
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Added missing Solarized themes, see #1027
|
||||
- Fixed highlighting bug in Haskell source files, see #1026
|
||||
|
||||
# v0.15.3
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Cannot run `bat` with relative paths, see #1022
|
||||
- bat mishighlights Users that start with digits in SSH config, see #984
|
||||
|
||||
## New syntaxes
|
||||
|
||||
- SML, see #1005 (@kopecs)
|
||||
|
||||
## New themes
|
||||
## Other
|
||||
|
||||
- Some syntaxes and themes have been updated to the latest version
|
||||
|
||||
# v0.15.2
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix syntax detection for files called 'rails', see #1008
|
||||
- Fix potential errors with syntax detection for symlinked files, see #1001
|
||||
- `--map-syntax` doesn't work with names provided through `--file-name` (@eth-p)
|
||||
|
||||
## Other
|
||||
|
||||
- Add padding above headers when not using a grid, see #968 and #981 (@pt2121)
|
||||
- bat now prints an error if an invalid syntax is specified via `-l` or `--map-syntax`, see #1004 (@eth-p)
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
|
||||
Generated
+303
-483
File diff suppressed because it is too large
Load Diff
+8
-9
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.15.2"
|
||||
version = "0.16.0"
|
||||
exclude = [
|
||||
"assets/syntaxes/*",
|
||||
"assets/themes/*",
|
||||
@@ -25,7 +25,6 @@ application = [
|
||||
"dirs",
|
||||
"git",
|
||||
"lazy_static",
|
||||
"liquid",
|
||||
"paging",
|
||||
"wild",
|
||||
"regex-onig",
|
||||
@@ -39,19 +38,19 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
atty = { version = "0.2.14", optional = true }
|
||||
ansi_term = "^0.12.1"
|
||||
ansi_colours = "^1.0"
|
||||
console = "0.11.2"
|
||||
dirs = { version = "2.0", optional = true }
|
||||
console = "0.12.0"
|
||||
dirs = { version = "3.0", optional = true }
|
||||
lazy_static = { version = "1.4", optional = true }
|
||||
wild = { version = "2.0", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
encoding = "0.2"
|
||||
shell-words = { version = "1.0.0", optional = true }
|
||||
unicode-width = "0.1.7"
|
||||
unicode-width = "0.1.8"
|
||||
globset = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.8"
|
||||
semver = "0.9"
|
||||
path-absolutize = "1.2.0"
|
||||
semver = "0.11"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
|
||||
[dependencies.git2]
|
||||
version = "0.13"
|
||||
@@ -59,7 +58,7 @@ optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.syntect]
|
||||
version = "4.2.0"
|
||||
version = "4.4.0"
|
||||
default-features = false
|
||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||
|
||||
@@ -76,10 +75,10 @@ default-features = false
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
assert_cmd = "1.0.1"
|
||||
predicates = "1.0.5"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "2.33", optional = true }
|
||||
liquid = { version = "0.20", optional = true }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<p align="center">
|
||||
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></a>
|
||||
<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>
|
||||
A <i>cat(1)</i> clone with syntax highlighting and Git integration.
|
||||
@@ -12,8 +11,8 @@
|
||||
<a href="#how-to-use">How To Use</a> •
|
||||
<a href="#installation">Installation</a> •
|
||||
<a href="#customization">Customization</a> •
|
||||
<a href="#project-goals-and-alternatives">Project goals, alternatives</a> •
|
||||
Translation [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="doc/README-ja.md">日本語</a>][<a href="doc/README-ko.md">한국어</a>]
|
||||
<a href="#project-goals-and-alternatives">Project goals, alternatives</a><br>
|
||||
[<a href="https://github.com/chinanf-boy/bat-zh">中文</a>] [<a href="doc/README-ja.md">日本語</a>] [<a href="doc/README-ko.md">한국어</a>] [<a href="doc/README-ru.md">Русский</a>]
|
||||
</p>
|
||||
|
||||
### Syntax highlighting
|
||||
@@ -39,7 +38,7 @@ characters:
|
||||
|
||||
### Automatic paging
|
||||
|
||||
`bat` can pipe its own output to `less` if the output is too large for one screen.
|
||||
`bat` can pipe its own output to a pager (e.g `less`) if the output is too large for one screen.
|
||||
|
||||
### File concatenation
|
||||
|
||||
@@ -62,7 +61,9 @@ Display multiple files at once
|
||||
> bat src/*.rs
|
||||
```
|
||||
|
||||
Read from stdin, determine the syntax automatically
|
||||
Read from stdin, determine the syntax automatically (note, highlighting will
|
||||
only work if the syntax can be determined from the first line of the file,
|
||||
usually through a shebang such as `#!/bin/sh`)
|
||||
|
||||
```bash
|
||||
> curl -s https://sh.rustup.rs | bat
|
||||
@@ -159,6 +160,8 @@ If you prefer to have this bundled in a new command, you can also use [`batman`]
|
||||
|
||||
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`.
|
||||
@@ -183,7 +186,7 @@ apt install bat
|
||||
```
|
||||
|
||||
If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||
clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distrutions:
|
||||
clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
@@ -197,7 +200,7 @@ the most recent release of `bat`, download the latest `.deb` package from the
|
||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.2_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.16.0_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -292,6 +295,10 @@ port install bat
|
||||
There are a few options to install `bat` on Windows. Once you have installed `bat`,
|
||||
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://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
#### With Chocolatey
|
||||
|
||||
You can install `bat` via [Chocolatey](https://chocolatey.org/packages/Bat):
|
||||
@@ -306,50 +313,12 @@ You can install `bat` via [scoop](https://scoop.sh/):
|
||||
scoop install bat
|
||||
```
|
||||
|
||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
#### From prebuilt binaries:
|
||||
|
||||
You can download prebuilt binaries from the [Release page](https://github.com/sharkdp/bat/releases),
|
||||
|
||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
### Via Docker
|
||||
|
||||
There is a [Docker image](https://hub.docker.com/r/danlynn/bat/) that you can use to run `bat` in a container:
|
||||
```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'
|
||||
```
|
||||
|
||||
### Via Ansible
|
||||
|
||||
You can install `bat` with [Ansible](https://www.ansible.com/):
|
||||
|
||||
```bash
|
||||
# Install role on local machine
|
||||
ansible-galaxy install aeimer.install_bat
|
||||
```
|
||||
|
||||
```yaml
|
||||
---
|
||||
# Playbook to install bat
|
||||
- host: all
|
||||
roles:
|
||||
- aeimer.install_bat
|
||||
```
|
||||
|
||||
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
||||
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
||||
|
||||
This should work with the following distributions:
|
||||
- Debian/Ubuntu
|
||||
- ARM (eg. Raspberry PI)
|
||||
- Arch Linux
|
||||
- Void Linux
|
||||
- FreeBSD
|
||||
- MacOS
|
||||
|
||||
### From binaries
|
||||
|
||||
Check out the [Release page](https://github.com/sharkdp/bat/releases) for
|
||||
@@ -365,6 +334,9 @@ higher. You can then use `cargo` to build everything:
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
Note that addition files like the man page or shell completion
|
||||
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
|
||||
@@ -387,6 +359,26 @@ light background, some themes like `GitHub` or `OneHalfLight` will work better f
|
||||
You can also use a custom theme by following the
|
||||
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
||||
|
||||
### 8-bit themes
|
||||
|
||||
`bat` has four themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||
even when truecolor support is available:
|
||||
|
||||
- `ansi-dark` looks decent on any terminal with a dark background. It uses 3-bit colors: black, red,
|
||||
green, yellow, blue, magenta, cyan, and white.
|
||||
- `ansi-light` is like `ansi-dark`, but for terminals with a light background.
|
||||
- `base16` is designed for [base16](https://github.com/chriskempson/base16) terminal themes. It uses
|
||||
4-bit colors (3-bit colors plus bright variants) in accordance with the
|
||||
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||
- `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 base16-shell.
|
||||
|
||||
Although these themes are more restricted, they have two advantages over truecolor themes:
|
||||
|
||||
- They harmonize better with other terminal software using 3-bit or 4-bit colors.
|
||||
- When you change your terminal theme, `bat` output already on the screen will update to match.
|
||||
|
||||
### Output style
|
||||
|
||||
You can use the `--style` option to control the appearance of `bat`s output.
|
||||
@@ -476,6 +468,16 @@ If you want to enable mouse-wheel scrolling on older versions of `less`, you can
|
||||
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
|
||||
|
||||
`bat` expands tabs to 4 spaces by itself, not relying on the pager. To change this, simply add the
|
||||
`--tabs` argument with the number of spaces you want to be displayed.
|
||||
|
||||
**Note**: Defining tab stops for the pager (via the `--pager` argument by `bat`, or via the `LESS`
|
||||
environment variable for `less`) won't be taken into account because the pager will already get
|
||||
expanded spaces instead of tabs. This behaviour is added to avoid indentation issues caused by the
|
||||
sidebar. Calling `bat` with `--tabs=0` will override it and let tabs be consumed by the pager.
|
||||
|
||||
### Dark mode
|
||||
|
||||
If you make use of the dark mode feature in macOS, you might want to configure `bat` to use a different
|
||||
@@ -531,6 +533,10 @@ Example configuration file:
|
||||
|
||||
`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You will need to install the [Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) package.
|
||||
|
||||
### Paging
|
||||
|
||||
Windows only includes a very limited pager in the form of `more`. You can download a Windows binary
|
||||
@@ -573,9 +579,10 @@ bat() {
|
||||
|
||||
### Terminals & colors
|
||||
|
||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in the syntax
|
||||
highlighting themes are not optimized for 8-bit colors and it is therefore strongly recommended
|
||||
that you use a terminal with 24-bit truecolor support (`terminator`, `konsole`, `iTerm2`, ...).
|
||||
`bat` handles terminals *with* and *without* truecolor support. However, the colors in most syntax
|
||||
highlighting themes are not optimized for 8-bit colors. It is therefore strongly recommended
|
||||
that you use a terminal with 24-bit truecolor support (`terminator`, `konsole`, `iTerm2`, ...),
|
||||
or use one of the basic [8-bit themes](#8-bit-themes) designed for a restricted set of colors.
|
||||
See [this article](https://gist.github.com/XVilka/8346728) for more details and a full list of
|
||||
terminals with truecolor support.
|
||||
|
||||
@@ -641,6 +648,6 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
||||
## License
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` is distributed under the terms of both the MIT License and the Apache License 2.0.
|
||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||
|
||||
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
environment:
|
||||
global:
|
||||
TARGET: x86_64-pc-windows-msvc
|
||||
RUST_VERSION: stable
|
||||
CRATE_NAME: bat
|
||||
CARGO_HOME: "c:\\cargo"
|
||||
RUSTUP_HOME: "c:\\rustup"
|
||||
|
||||
install:
|
||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -y --default-host %TARGET% --profile minimal
|
||||
- set PATH=%PATH%;C:\cargo\bin
|
||||
- rustc -Vv
|
||||
- cargo -V
|
||||
|
||||
build: false
|
||||
test_script:
|
||||
- cargo test --target %TARGET% --verbose
|
||||
- cargo run --target %TARGET% -- src/bin/bat/main.rs README.md --paging=never
|
||||
|
||||
before_deploy:
|
||||
# Generate artifacts for release
|
||||
- cargo build --bins --release --verbose
|
||||
- ps: ci\before_deploy.ps1
|
||||
|
||||
deploy:
|
||||
description: 'Automatically deployed release'
|
||||
artifact: /.*\.zip/
|
||||
# Here's how:
|
||||
# - Go to 'https://github.com/settings/tokens/new' and generate a Token with only the
|
||||
# `public_repo` scope enabled
|
||||
# - Then go to 'https://ci.appveyor.com/tools/encrypt' and enter the newly generated token.
|
||||
# - Enter the "encrypted value" below
|
||||
auth_token:
|
||||
secure: oO4/J+hcFXgXcEqEc8gzlQNqLG0IxU78s4EyH+uczGdsyWajb3yipxPR6nXUvmoj
|
||||
provider: GitHub
|
||||
on:
|
||||
RUST_VERSION: stable
|
||||
appveyor_repo_tag: true
|
||||
|
||||
cache:
|
||||
- C:\Users\appveyor\.cargo\registry
|
||||
- target
|
||||
|
||||
notifications:
|
||||
- provider: Email
|
||||
on_build_success: false
|
||||
on_build_failure: false
|
||||
on_build_status_changed: false
|
||||
Vendored
+3
-1
@@ -31,6 +31,7 @@ themes (`bat cache --clear`).
|
||||
|
||||
The following files have been manually modified after converting from a `.tmLanguage` file:
|
||||
|
||||
* `Apache.sublime_syntax`=> removed `.conf` and `.CONF` file types.
|
||||
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
||||
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types.
|
||||
* `Org mode.sublime-syntax` => removed `task` file type.
|
||||
@@ -47,4 +48,5 @@ The following files have been manually modified after converting from a `.tmLang
|
||||
https://github.com/seanjames777/SML-Language-Definitiona as it is not
|
||||
kept in a standalone repository. The file generated is from
|
||||
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.
|
||||
|
||||
Vendored
+2
@@ -52,6 +52,8 @@ complete -c {{PROJECT_EXECUTABLE}} -l paging -xka "auto never always" -d "Specif
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s p -l plain -d "Only show plain style, no decorations. Alias for '--style=plain'" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=never'" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid numbers" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
|
||||
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
#compdef {{PROJECT_EXECUTABLE}}
|
||||
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
(( $+functions[_cache_subcommand] )) ||
|
||||
_cache_subcommand() {
|
||||
local -a args
|
||||
args=(
|
||||
'(-b --build -c --clear)'{-b,--build}'[Initialize or update the syntax/theme cache]'
|
||||
'(-b --build -c --clear)'{-c,--clear}'[Remove the cached syntax definitions and themes]'
|
||||
'(--source)'--source='[Use a different directory to load syntaxes and themes from]:directory:_files -/'
|
||||
'(--target)'--target='[Use a different directory to store the cached syntax and theme set]:directory:_files -/'
|
||||
'(--blank)'--blank'[Create completely new syntax and theme sets]'
|
||||
'(: -)'{-h,--help}'[Prints help information]'
|
||||
'*: :'
|
||||
)
|
||||
|
||||
_arguments -S -s $args
|
||||
}
|
||||
|
||||
(( $+functions[_main] )) ||
|
||||
_main() {
|
||||
local -a args
|
||||
args=(
|
||||
'(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
|
||||
{-p,--plain}'[Show plain style (alias for `--style=plain`)]:When `-p` is used twice (`-pp`), it also disables automatic paging (alias for `--style=plain --paging=never`)'
|
||||
'(-l --language)'{-l+,--language=}'[Set the language for syntax highlighting]:<language>:->language'
|
||||
'(-H --highlight-line)'{-H,--highlight-line}'[Highlight lines N through M]:<N\:M>...'
|
||||
'(--file-name)'--file-name'[Specify the name to display for a file]:<name>...:_files'
|
||||
'(-d --diff)'--diff'[Only show lines that have been added/removed/modified]'
|
||||
'(--diff-context)'--diff-context'[Include N lines of context around added/removed/modified lines when using `--diff`]:<N> (lines):()'
|
||||
'(--tabs)'--tabs'[Set the tab width to T spaces]:<T> (tab width):()'
|
||||
'(--wrap)'--wrap='[Specify the text-wrapping mode]:<when>:(auto never character)'
|
||||
'(--terminal-width)'--terminal-width'[Explicitly set the width of the terminal instead of determining it automatically]:<width>'
|
||||
'(-n --number)'{-n,--number}'[Show line numbers]'
|
||||
'(--color)'--color='[When to use colors]:<when>:(auto never always)'
|
||||
'(--italic-text)'--italic-text='[Use italics in output]:<when>:(always never)'
|
||||
'(--decorations)'--decorations='[When to show the decorations]:<when>:(auto never always)'
|
||||
'(--paging)'--paging='[Specify when to use the pager]:<when>:(auto never always)'
|
||||
'(-m --map-syntax)'{-m+,--map-syntax=}'[Use the specified syntax for files matching the glob pattern]:<glob\:syntax>...'
|
||||
'(--theme)'--theme='[Set the color theme for syntax highlighting]:<theme>:->theme'
|
||||
'(: --list-themes --list-languages -L)'--list-themes'[Display all supported highlighting themes]'
|
||||
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
||||
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
||||
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
||||
'(: -)'{-h,--help}'[Print this help message]'
|
||||
'(: -)'{-V,--version}'[Show version information]'
|
||||
'*: :_files'
|
||||
)
|
||||
|
||||
_arguments -S -s $args
|
||||
|
||||
case "$state" in
|
||||
language)
|
||||
local IFS=$'\n'
|
||||
local -a languages
|
||||
languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
|
||||
|
||||
_describe 'language' languages
|
||||
;;
|
||||
|
||||
theme)
|
||||
local IFS=$'\n'
|
||||
local -a themes
|
||||
themes=( $({{PROJECT_EXECUTABLE}} --list-themes | sort) )
|
||||
|
||||
_values 'theme' $themes
|
||||
;;
|
||||
|
||||
style)
|
||||
_values -s , 'style' auto full plain changes header grid numbers snip
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# first positional argument
|
||||
if (( ${#words} == 2 )); then
|
||||
local -a subcommands
|
||||
subcommands=('cache:Modify the syntax-definition and theme cache')
|
||||
_describe subcommand subcommands
|
||||
_main
|
||||
else
|
||||
case $words[2] in
|
||||
cache)
|
||||
_cache_subcommand
|
||||
;;
|
||||
|
||||
*)
|
||||
_main
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
Vendored
+48
-7
@@ -1,4 +1,4 @@
|
||||
.TH {{PROJECT_EXECUTABLE | upcase}} "1"
|
||||
.TH {{PROJECT_EXECUTABLE_UPPERCASE}} "1"
|
||||
.SH NAME
|
||||
{{PROJECT_EXECUTABLE}} \- a cat(1) clone with syntax highlighting and Git integration.
|
||||
.SH "USAGE"
|
||||
@@ -87,17 +87,22 @@ Specify when to use the decorations that have been specified via '\-\-style'. Th
|
||||
automatic mode only enables decorations if an interactive terminal is detected. Possible
|
||||
values: *auto*, never, always.
|
||||
.HP
|
||||
\fB\-f\fR, \fB\-\-force\-colorization\fR
|
||||
.IP
|
||||
Alias for '--decorations=always --color=always'. This is useful \
|
||||
if the output of bat is piped to another program, but you want \
|
||||
to keep the colorization/decorations.
|
||||
.HP
|
||||
\fB\-\-paging\fR <when>
|
||||
.IP
|
||||
Specify when to use the pager. To control which pager is used, set the PAGER or
|
||||
BAT_PAGER environment variables (the latter takes precedence) or use the '\-\-pager'
|
||||
option. To disable the pager permanently, set BAT_PAGER to an empty string or set
|
||||
\&'\-\-paging=never' in the configuration file. Possible values: *auto*, never, always.
|
||||
Specify when to use the pager. To disable the pager, use \&'\-\-paging=never' or its alias,
|
||||
\fB-P\fR. To disable the pager permanently, set BAT_PAGER to an empty string. To control
|
||||
which pager is used, see the '\-\-pager' option. Possible values: *auto*, never, always.
|
||||
.HP
|
||||
\fB\-\-pager\fR <command>
|
||||
.IP
|
||||
Determine which pager is used. This option will overwrite the PAGER and BAT_PAGER
|
||||
environment variables. The default pager is 'less'. To disable the pager completely, use
|
||||
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
||||
environment variables. The default pager is 'less'. To control when the pager is used, see
|
||||
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
|
||||
.HP
|
||||
\fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
|
||||
@@ -171,3 +176,39 @@ is dependent on your operating system. To get the default path for your system,
|
||||
|
||||
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point bat to a non-default
|
||||
location of 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-snytax\fR language
|
||||
files to `\fB$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes\fR` and run `\fBbat cache --build\fR`.
|
||||
|
||||
\fBExample:\fR
|
||||
|
||||
.RS 0.5i
|
||||
mkdir -p "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
|
||||
.br
|
||||
cd "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
|
||||
|
||||
# Put new '.sublime-syntax' language definition files
|
||||
.br
|
||||
# in this folder (or its subdirectories), for example:
|
||||
.br
|
||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||
|
||||
# And then build the cache.
|
||||
.br
|
||||
{{PROJECT_EXECUTABLE}} cache --build
|
||||
.RE
|
||||
|
||||
Once the cache is built, the new language will be visible in `\fBbat --list-languages\fR`.
|
||||
.br
|
||||
If you ever want to remove the custom languages, you can clear the cache with `\fBbat cache --clear\fR`.
|
||||
|
||||
.SH "ADDING CUSTOM THEMES"
|
||||
Similarly to custom languages, {{PROJECT_EXECUTABLE}} supports Sublime Text \fB.tmTheme\fR themes.
|
||||
These can be installed to `\fB$({{PROJECT_EXECUTABLE}} --config-dir)/themes\fR`, and are added to the cache with
|
||||
`\fB{{PROJECT_EXECUTABLE}} cache --build`.
|
||||
.SH "MORE INFORMATION"
|
||||
|
||||
For more information and up-to-date documentation, visit the {{PROJECT_EXECUTABLE}} repo:
|
||||
.br
|
||||
\fBhttps://github.com/sharkdp/bat\fR
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/AWK updated: 1ce5f90d44...e593eb6d42
+1
Submodule assets/syntaxes/02_Extra/Apache added at 163bc03ae8
+221
@@ -0,0 +1,221 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Apache Conf
|
||||
file_extensions:
|
||||
- envvars
|
||||
- htaccess
|
||||
- HTACCESS
|
||||
- htgroups
|
||||
- HTGROUPS
|
||||
- htpasswd
|
||||
- HTPASSWD
|
||||
- .htaccess
|
||||
- .HTACCESS
|
||||
- .htgroups
|
||||
- .HTGROUPS
|
||||
- .htpasswd
|
||||
- .HTPASSWD
|
||||
scope: source.apacheconf
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\s)*(#).*$\n?
|
||||
scope: comment.line.hash.ini
|
||||
captures:
|
||||
1: punctuation.definition.comment.apacheconf
|
||||
- match: (<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost|Macro|If|Else|ElseIf)(\s(.+?))?(>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.apacheconf
|
||||
2: entity.tag.apacheconf
|
||||
4: string.value.apacheconf
|
||||
5: punctuation.definition.tag.apacheconf
|
||||
- match: (</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost|Macro|If|Else|ElseIf)(>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.apacheconf
|
||||
2: entity.tag.apacheconf
|
||||
3: punctuation.definition.tag.apacheconf
|
||||
- match: (?<=(Rewrite(Rule|Cond)))\s+(.+?)\s+(.+?)($|\s)
|
||||
captures:
|
||||
3: string.regexp.apacheconf
|
||||
4: string.replacement.apacheconf
|
||||
- match: (?<=RedirectMatch)(\s+(\d\d\d|permanent|temp|seeother|gone))?\s+(.+?)\s+((.+?)($|\s))?
|
||||
captures:
|
||||
2: entity.status.apacheconf
|
||||
3: string.regexp.apacheconf
|
||||
5: string.path.apacheconf
|
||||
- match: (?<=Redirect)(\s+(\d\d\d|permanent|temp|seeother|gone))?\s+(.+?)\s+((.+?)($|\s))?
|
||||
captures:
|
||||
2: entity.status.apacheconf
|
||||
3: string.path.apacheconf
|
||||
5: string.path.apacheconf
|
||||
- match: (?<=ScriptAliasMatch|AliasMatch)\s+(.+?)\s+((.+?)\s)?
|
||||
captures:
|
||||
1: string.regexp.apacheconf
|
||||
3: string.path.apacheconf
|
||||
- match: (?<=RedirectPermanent|RedirectTemp|ScriptAlias|Alias)\s+(.+?)\s+((.+?)($|\s))?
|
||||
captures:
|
||||
1: string.path.apacheconf
|
||||
3: string.path.apacheconf
|
||||
- match: \b(AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|Define|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include(Optional)?|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|Mutex|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|Time(O|o)ut|TraceEnable|UseCanonicalName|Use|ErrorLogFormat|GlobalLog|PHPIniDir|SSLHonorCipherOrder|SSLCompression|SSLUseStapling|SSLStapling\w+|SSLCARevocationCheck|SSLSRPVerifierFile|SSLSessionTickets|RequestReadTimeout|ProxyHTML\w+|MaxRanges)\b
|
||||
captures:
|
||||
1: keyword.core.apacheconf
|
||||
- match: \b(AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxConnectionsPerChild|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxRequestWorkers|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\b
|
||||
captures:
|
||||
1: keyword.mpm.apacheconf
|
||||
- match: \b(Allow|Deny|Order)\b
|
||||
captures:
|
||||
1: keyword.access.apacheconf
|
||||
- match: \b(Action|Script)\b
|
||||
captures:
|
||||
1: keyword.actions.apacheconf
|
||||
- match: \b(Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\b
|
||||
captures:
|
||||
1: keyword.alias.apacheconf
|
||||
- match: \b(AuthAuthoritative|AuthGroupFile|AuthUserFile|AuthBasicProvider|AuthBasicFake|AuthBasicAuthoritative|AuthBasicUseDigestAlgorithm)\b
|
||||
captures:
|
||||
1: keyword.auth.apacheconf
|
||||
- match: \b(Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\b
|
||||
captures:
|
||||
1: keyword.auth_anon.apacheconf
|
||||
- match: \b(AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\b
|
||||
captures:
|
||||
1: keyword.auth_dbm.apacheconf
|
||||
- match: \b(AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize|AuthDigestProvider)\b
|
||||
captures:
|
||||
1: keyword.auth_digest.apacheconf
|
||||
- match: \b(AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\b
|
||||
captures:
|
||||
1: keyword.auth_ldap.apacheconf
|
||||
- match: \b(AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|IndexStyleSheet|IndexHeadInsert|ReadmeName)\b
|
||||
captures:
|
||||
1: keyword.autoindex.apacheconf
|
||||
- match: \b(BalancerMember|BalancerGrowth|BalancerPersist|BalancerInherit)\b
|
||||
captures:
|
||||
1: keyword.filter.apacheconf
|
||||
- match: \b(CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\b
|
||||
captures:
|
||||
1: keyword.cache.apacheconf
|
||||
- match: \b(MetaDir|MetaFiles|MetaSuffix)\b
|
||||
captures:
|
||||
1: keyword.cern_meta.apacheconf
|
||||
- match: \b(ScriptLog|ScriptLogBuffer|ScriptLogLength)\b
|
||||
captures:
|
||||
1: keyword.cgi.apacheconf
|
||||
- match: \b(ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\b
|
||||
captures:
|
||||
1: keyword.cgid.apacheconf
|
||||
- match: \b(CharsetDefault|CharsetOptions|CharsetSourceEnc)\b
|
||||
captures:
|
||||
1: keyword.charset_lite.apacheconf
|
||||
- match: \b(Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\b
|
||||
captures:
|
||||
1: keyword.dav.apacheconf
|
||||
- match: \b(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\b
|
||||
captures:
|
||||
1: keyword.deflate.apacheconf
|
||||
- match: \b(DirectoryIndex|DirectorySlash|FallbackResource)\b
|
||||
captures:
|
||||
1: keyword.dir.apacheconf
|
||||
- match: \b(CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\b
|
||||
captures:
|
||||
1: keyword.disk_cache.apacheconf
|
||||
- match: \b(DumpIOInput|DumpIOOutput)\b
|
||||
captures:
|
||||
1: keyword.dumpio.apacheconf
|
||||
- match: \b(PassEnv|SetEnv|UnsetEnv)\b
|
||||
captures:
|
||||
1: keyword.env.apacheconf
|
||||
- match: \b(ExpiresActive|ExpiresByType|ExpiresDefault)\b
|
||||
captures:
|
||||
1: keyword.expires.apacheconf
|
||||
- match: \b(ExtFilterDefine|ExtFilterOptions)\b
|
||||
captures:
|
||||
1: keyword.ext_filter.apacheconf
|
||||
- match: \b(CacheFile|MMapFile)\b
|
||||
captures:
|
||||
1: keyword.file_cache.apacheconf
|
||||
- match: \b(AddOutputFilterByType|FilterChain|FilterDeclare|FilterProtocol|FilterProvider|FilterTrace)\b
|
||||
captures:
|
||||
1: keyword.filter.apacheconf
|
||||
- match: \b(Header|RequestHeader)\b
|
||||
captures:
|
||||
1: keyword.headers.apacheconf
|
||||
- match: \b(ImapBase|ImapDefault|ImapMenu)\b
|
||||
captures:
|
||||
1: keyword.imap.apacheconf
|
||||
- match: \b(SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\b
|
||||
captures:
|
||||
1: keyword.include.apacheconf
|
||||
- match: \b(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\b
|
||||
captures:
|
||||
1: keyword.isapi.apacheconf
|
||||
- match: \b(LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\b
|
||||
captures:
|
||||
1: keyword.ldap.apacheconf
|
||||
- match: \b(BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\b
|
||||
captures:
|
||||
1: keyword.log.apacheconf
|
||||
- match: \b(MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\b
|
||||
captures:
|
||||
1: keyword.mem_cache.apacheconf
|
||||
- match: \b(AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\b
|
||||
captures:
|
||||
1: keyword.mime.apacheconf
|
||||
- match: \b(ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\b
|
||||
captures:
|
||||
1: keyword.misc.apacheconf
|
||||
- match: \b(CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\b
|
||||
captures:
|
||||
1: keyword.negotiation.apacheconf
|
||||
- match: \b(NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\b
|
||||
captures:
|
||||
1: keyword.nw_ssl.apacheconf
|
||||
- match: \b(AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassMatch|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\b
|
||||
captures:
|
||||
1: keyword.proxy.apacheconf
|
||||
- match: \b(RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\b
|
||||
captures:
|
||||
1: keyword.rewrite.apacheconf
|
||||
- match: \b(BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\b
|
||||
captures:
|
||||
1: keyword.setenvif.apacheconf
|
||||
- match: \b(LoadFile|LoadModule)\b
|
||||
captures:
|
||||
1: keyword.so.apacheconf
|
||||
- match: \b(SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|SSLInsecureRenegotiation|SSLOpenSSLConfCmd)\b
|
||||
captures:
|
||||
1: keyword.ssl.apacheconf
|
||||
- match: \b(Substitute|SubstituteInheritBefore|SubstituteMaxLineLength)\b
|
||||
captures:
|
||||
1: keyword.substitute.apacheconf
|
||||
- match: \b(CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\b
|
||||
captures:
|
||||
1: keyword.usertrack.apacheconf
|
||||
- match: \b(VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\b
|
||||
captures:
|
||||
1: keyword.vhost_alias.apacheconf
|
||||
- match: \b(php_value|php_flag|php_admin_value|php_admin_flag)\b(\s+(.+?)(\s+(".+?"|.+?))?)?\s
|
||||
captures:
|
||||
1: keyword.php.apacheconf
|
||||
3: entity.property.apacheconf
|
||||
5: string.value.apacheconf
|
||||
- match: '(%\{)((HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\})'
|
||||
captures:
|
||||
1: punctuation.variable.apacheconf
|
||||
3: variable.env.apacheconf
|
||||
4: variable.misc.apacheconf
|
||||
5: punctuation.variable.apacheconf
|
||||
- match: \b((text|image|application|video|audio)/.+?)\s
|
||||
captures:
|
||||
1: entity.mime-type.apacheconf
|
||||
- match: \b(?i)(export|from|unset|set|on|off)\b
|
||||
captures:
|
||||
1: entity.helper.apacheconf
|
||||
- match: \b(\d+)\b
|
||||
captures:
|
||||
1: constant.numeric.integer.decimal.apacheconf
|
||||
- match: '\s(\[)(.*?)(\])\s'
|
||||
captures:
|
||||
1: punctuation.definition.flag.apacheconf
|
||||
2: string.flag.apacheconf
|
||||
3: punctuation.definition.flag.apacheconf
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/AsciiDoc updated: d0089991e5...e316a0a85c
+967
-253
File diff suppressed because it is too large
Load Diff
Vendored
-1
Submodule assets/syntaxes/02_Extra/Cabal deleted from 2d98cb79eb
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Crystal updated: 2ee9d667ae...5e032ff5f5
+4
-3
@@ -108,7 +108,7 @@ contexts:
|
||||
- match: (?<!\.)\belse(\s)+if\b
|
||||
comment: else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want.
|
||||
scope: invalid.deprecated.crystal
|
||||
- match: '(?<!\.)\b(BEGIN|alias|as|begin|case|select|abstract|class|END|ensure|for|fun|if|ifdef|in|lib|module|of|out|private|protected|rescue|struct|with|union|enum|macro|then|type|unless|until|while)\b(?![?!])'
|
||||
- match: '(?<!\.)\b(BEGIN|alias|as|begin|case|select|abstract|class|END|ensure|for|fun|if|ifdef|in|lib|module|of|out|private|protected|rescue|struct|with|union|enum|macro|then|unless|until|while)\b(?![?!])|(?<!\.)\btype\b\s*(?=[A-Z])'
|
||||
comment: everything being a reserved word, not a value and needing a 'end' is a..
|
||||
scope: keyword.control.primary.crystal
|
||||
- match: '(?<!\.)\b(when|else|elsif)\b(?![?!])'
|
||||
@@ -131,7 +131,7 @@ contexts:
|
||||
scope: keyword.control.pseudo-method.crystal
|
||||
- match: '\b(nil|true|false)\b(?![?!])'
|
||||
scope: constant.language.crystal
|
||||
- match: '\b(__(DIR|FILE|LINE|END_LINE)__|self)\b(?![?!])'
|
||||
- match: '\b(__(DIR|FILE|LINE|END_LINE)__|self)\b(?![?!])|self[?]'
|
||||
scope: variable.language.crystal
|
||||
- match: '\b(initialize|new|loop|include|extend|raise|getter|setter|property|class_getter|class_setter|class_property|describe|context|it|with|delegate|def_hash|def_equals|def_equals_and_hash|forward_missing_to|record|assert_responds_to|spawn|annotation|verbatim)\b[!?]?'
|
||||
comment: everything being a method but having a special function is a..
|
||||
@@ -190,7 +190,7 @@ contexts:
|
||||
push:
|
||||
- meta_scope: meta.function.method.with-arguments.crystal
|
||||
- meta_content_scope: variable.parameter.function.crystal
|
||||
- match: \)\s*$|\)\s*:|\)\s*;
|
||||
- match: \)
|
||||
captures:
|
||||
0: punctuation.definition.parameters.crystal
|
||||
pop: true
|
||||
@@ -705,6 +705,7 @@ contexts:
|
||||
0: punctuation.definition.string.end.crystal
|
||||
pop: true
|
||||
- include: heredoc
|
||||
- include: scope:text.html.basic
|
||||
- include: scope:source.js
|
||||
- include: interpolated_crystal
|
||||
- include: escaped_char
|
||||
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Elixir updated: 1f010d5f63...4ee539b43d
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Email updated: ee3e68fce2...e89d09d440
@@ -4,6 +4,7 @@
|
||||
name: fstab
|
||||
file_extensions:
|
||||
- fstab
|
||||
- crypttab
|
||||
scope: source.fstab
|
||||
|
||||
contexts:
|
||||
|
||||
+1
Submodule assets/syntaxes/02_Extra/GLSL added at 4cd4acfffc
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/LESS updated: 3020993658...44632e19af
+1
Submodule assets/syntaxes/02_Extra/Nginx added at 15a1db1510
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: b98a3f3ccf...bc6332c1be
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/TypeScript updated: 9cd994af73...f21aba57c5
+56
-35
@@ -9,10 +9,7 @@ contexts:
|
||||
main:
|
||||
- include: directives
|
||||
- include: statements
|
||||
- match: \A(#!).*(?=$)
|
||||
scope: comment.line.shebang.ts
|
||||
captures:
|
||||
1: punctuation.definition.comment.ts
|
||||
- include: shebang
|
||||
comment:
|
||||
- match: /\*\*(?!/)
|
||||
captures:
|
||||
@@ -120,7 +117,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -815,7 +812,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -856,7 +853,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -918,7 +915,7 @@ contexts:
|
||||
captures:
|
||||
1: keyword.control.as.ts
|
||||
push:
|
||||
- match: '(?=$|^|[;,:})\]]|\|\||\&\&|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
|
||||
- match: '(?=^|[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+)|(\s+\<))'
|
||||
pop: true
|
||||
- include: type
|
||||
- match: \.\.\.
|
||||
@@ -933,7 +930,7 @@ contexts:
|
||||
scope: keyword.operator.comparison.ts
|
||||
- match: <=|>=|<>|<|>
|
||||
scope: keyword.operator.relational.ts
|
||||
- match: '(\!)\s*(/)(?![/*])'
|
||||
- match: '(?<=[_$[:alnum:]])(\!)\s*(/)(?![/*])'
|
||||
captures:
|
||||
1: keyword.operator.logical.ts
|
||||
2: keyword.operator.arithmetic.ts
|
||||
@@ -1038,7 +1035,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -1079,7 +1076,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -1125,25 +1122,42 @@ contexts:
|
||||
- match: \*
|
||||
scope: keyword.generator.asterisk.ts
|
||||
function-call:
|
||||
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
||||
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||
push:
|
||||
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
||||
- match: '(?<=\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||
pop: true
|
||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||
push:
|
||||
- meta_scope: meta.function-call.ts
|
||||
- match: '(?=\s*(?:(\?\.\s*)|(\!))?(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\()'
|
||||
- match: '(?=\s*(?:(\?\.\s*)|(\!))?((<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?\())'
|
||||
pop: true
|
||||
- include: support-function-call-identifiers
|
||||
- match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
|
||||
scope: entity.name.function.ts
|
||||
- include: function-call-target
|
||||
- include: comment
|
||||
- match: \?\.
|
||||
scope: meta.function-call.ts punctuation.accessor.optional.ts
|
||||
- match: \!
|
||||
scope: meta.function-call.ts keyword.operator.definiteassignment.ts
|
||||
- include: function-call-optionals
|
||||
- include: type-arguments
|
||||
- include: paren-expression
|
||||
- match: '(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
|
||||
push:
|
||||
- match: '(?<=\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\)]))(<\s*[\{\[\(]\s*$))'
|
||||
pop: true
|
||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*)(\s*\??\.\s*(\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\??\.\s*\#?[_$[:alpha:]][_$[:alnum:]]*))'
|
||||
push:
|
||||
- meta_scope: meta.function-call.ts
|
||||
- match: '(?=(<\s*[\{\[\(]\s*$))'
|
||||
pop: true
|
||||
- include: function-call-target
|
||||
- include: comment
|
||||
- include: function-call-optionals
|
||||
- include: type-arguments
|
||||
function-call-optionals:
|
||||
- match: \?\.
|
||||
scope: meta.function-call.ts punctuation.accessor.optional.ts
|
||||
- match: \!
|
||||
scope: meta.function-call.ts keyword.operator.definiteassignment.ts
|
||||
function-call-target:
|
||||
- include: support-function-call-identifiers
|
||||
- match: '(\#?[_$[:alpha:]][_$[:alnum:]]*)'
|
||||
scope: entity.name.function.ts
|
||||
function-declaration:
|
||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(?:(\bexport)\s+)?(?:(\bdeclare)\s+)?(?:(async)\s+)?(function\b)(?:\s*(\*))?(?:(?:\s+|(?<=\*))([_$[:alpha:]][_$[:alnum:]]*))?\s*'
|
||||
captures:
|
||||
@@ -1221,7 +1235,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -1431,7 +1445,7 @@ contexts:
|
||||
captures:
|
||||
1: keyword.operator.expression.instanceof.ts
|
||||
push:
|
||||
- match: '(?<=\))|(?=[;),}\]:?]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|(([\&\~\^\|]\s*)?[_$[:alpha:]][_$[:alnum:]]*\s+instanceof(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||
pop: true
|
||||
- include: type
|
||||
interface-declaration:
|
||||
@@ -1582,7 +1596,7 @@ contexts:
|
||||
1: keyword.operator.new.ts
|
||||
push:
|
||||
- meta_scope: new.expr.ts
|
||||
- match: '(?<=\))|(?=[;),}\]:\-\+]|\|\||\&\&|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||
- match: '(?<=\))|(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))new(?![_$[:alnum:]])(?:(?=\.\.\.)|(?!\.)))|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))function((\s+[_$[:alpha:]][_$[:alnum:]]*)|(\s*[\(]))))'
|
||||
pop: true
|
||||
- include: paren-expression
|
||||
- include: class-declaration
|
||||
@@ -1864,7 +1878,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -1900,7 +1914,7 @@ contexts:
|
||||
1: keyword.control.as.ts
|
||||
push:
|
||||
- meta_scope: meta.object.member.ts
|
||||
- match: '(?=$|^|[,}]|\|\||\&\&|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
|
||||
- match: '(?=[;),}\]:?\-\+\>]|\|\||\&\&|\!\=\=|$|^|((?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))(as)\s+))'
|
||||
pop: true
|
||||
- include: type
|
||||
- match: '(?=[_$[:alpha:]][_$[:alnum:]]*\s*=)'
|
||||
@@ -2010,7 +2024,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -2051,7 +2065,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -2313,6 +2327,11 @@ contexts:
|
||||
- include: type-object
|
||||
- include: type-predicate-operator
|
||||
- include: type
|
||||
shebang:
|
||||
- match: \A(#!).*(?=$)
|
||||
scope: comment.line.shebang.ts
|
||||
captures:
|
||||
1: punctuation.definition.comment.ts
|
||||
single-line-comment-consuming-line-ending:
|
||||
- match: '(^[ \t]+)?((//)(?:\s*((@)internal)(?=\s|$))?)'
|
||||
captures:
|
||||
@@ -2684,20 +2703,20 @@ contexts:
|
||||
0: case-clause.expr.ts punctuation.definition.section.case-statement.ts
|
||||
- include: statements
|
||||
template:
|
||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||
push:
|
||||
- meta_scope: string.template.ts
|
||||
- match: (?=`)
|
||||
pop: true
|
||||
- match: '(?=(([_$[:alpha:]][_$[:alnum:]]*\s*\??\.\s*)*|(\??\.\s*)?)([_$[:alpha:]][_$[:alnum:]]*))'
|
||||
push:
|
||||
- match: '(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||
- match: '(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)?`)'
|
||||
pop: true
|
||||
- include: support-function-call-identifiers
|
||||
- match: "([_$[:alpha:]][_$[:alnum:]]*)"
|
||||
scope: entity.name.function.tagged-template.ts
|
||||
- include: type-arguments
|
||||
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''[^\'']*\'')|(\"[^\"]*\")|(\`[^\`]*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
||||
- match: '([_$[:alpha:]][_$[:alnum:]]*)\s*(?=(<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))(([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>|\<\s*(((keyof|infer|awaited|typeof|readonly)\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\''([^\''\\]|\\.)*\'')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))(?=\s*([\<\>\,\.\[]|=>|&(?!&)|\|(?!\|)))))([^<>\(]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(?<==)\>)*(?<!=)\>))*(?<!=)\>)*(?<!=)>\s*)`)'
|
||||
captures:
|
||||
1: entity.name.function.tagged-template.ts
|
||||
push:
|
||||
@@ -2974,6 +2993,8 @@ contexts:
|
||||
scope: keyword.operator.ternary.ts
|
||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))infer(?=\s+[_$[:alpha:]])'
|
||||
scope: keyword.operator.expression.infer.ts
|
||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))awaited(?=\s+[_$[:alpha:]])'
|
||||
scope: keyword.operator.expression.awaited.ts
|
||||
- match: '(?<![_$[:alnum:]])(?:(?<=\.\.\.)|(?<!\.))import(?=\s*\()'
|
||||
scope: keyword.operator.expression.import.ts
|
||||
type-parameters:
|
||||
@@ -3159,7 +3180,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -3200,7 +3221,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -3246,7 +3267,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
@@ -3287,7 +3308,7 @@ contexts:
|
||||
# arrow function possible to detect only with => on same line
|
||||
(
|
||||
(<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<]|\<\s*([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\[([^\[\]]|(\[[^\[\]]*\]))*\]))([^=<>]|=[^<])*\>)*\>)*>\s*)? # typeparameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()]|(\(([^\(\)]|(\([^\(\)]*\)))*\)))*)?\) # parameters
|
||||
\(\s*(\/\*([^\*]|(\*[^\/]))*\*\/\s*)*(([_$[:alpha:]]|(\{([^\{\}]|(\{[^\{\}]*\}))*\})|(\[([^\[\]]|(\[[^\[\]]*\]))*\])|(\.\.\.\s*[_$[:alpha:]]))([^()\'\"\`]|(\(([^\(\)]|(\([^\(\)]*\)))*\))|(\'([^\'\\]|\\.)*\')|(\"([^\"\\]|\\.)*\")|(\`([^\`\\]|\\.)*\`))*)?\) # parameters
|
||||
(\s*:\s*([^<>\(\)\{\}]|\<([^<>]|\<[^<>]+\>)+\>|\([^\(\)]+\)|\{[^\{\}]+\})+)? # return type
|
||||
\s*=> # arrow operator
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ file_extensions:
|
||||
scope: whitespace
|
||||
contexts:
|
||||
main:
|
||||
- match: "•"
|
||||
- match: "·"
|
||||
scope: support.function.show-nonprintable.space
|
||||
- match: "├─*┤"
|
||||
scope: constant.character.escape.show-nonprintable.tab
|
||||
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/ssh-config updated: 3ec06d0e9c...1ddcb320ac
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
Submodule assets/themes/Solarized updated: 3707f68ddc...87e01090cf
Vendored
+551
@@ -0,0 +1,551 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
Most base16 users should use the base16 theme. This theme, base16-256,
|
||||
is for users who configure their terminal with a 256-color variant of a
|
||||
base16 theme, and who use base16-shell. DO NOT use this theme simply
|
||||
because your terminal supports 256 colors.
|
||||
|
||||
base16: https://github.com/chriskempson/base16
|
||||
base16-shell: https://github.com/chriskempson/base16-shell
|
||||
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to ff (the 256 terminal colors), and AA is the
|
||||
special value 00 to indicate this encoding is being used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
<key>name</key>
|
||||
<string>Base16 256</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#00000000</string>
|
||||
<key>caret</key>
|
||||
<string>#07000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
<key>invisibles</key>
|
||||
<string>#08000000</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#08000000</string>
|
||||
<key>selection</key>
|
||||
<string>#13000000</string>
|
||||
<key>gutter</key>
|
||||
<string>#12000000</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#08000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Text</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comments</string>
|
||||
<key>scope</key>
|
||||
<string>comment, punctuation.definition.comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#08000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Delimiters</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Operators</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keywords</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variables</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Functions</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function, meta.require, support.function.any-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Labels</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.label</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#11000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>meta.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#0f000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Methods</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.special-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Support</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Strings, Inherited Class</string>
|
||||
<key>scope</key>
|
||||
<string>string, constant.other.symbol, entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Integers</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Floats</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Boolean</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Constants</string>
|
||||
<key>scope</key>
|
||||
<string>constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tags</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attributes</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attribute IDs</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Selector</string>
|
||||
<key>scope</key>
|
||||
<string>meta.selector</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Values</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Units</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.unit</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Bold</string>
|
||||
<key>scope</key>
|
||||
<string>markup.bold, punctuation.definition.bold</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Italic</string>
|
||||
<key>scope</key>
|
||||
<string>markup.italic, punctuation.definition.italic</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Code</string>
|
||||
<key>scope</key>
|
||||
<string>markup.raw.inline</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Text</string>
|
||||
<key>scope</key>
|
||||
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Url</string>
|
||||
<key>scope</key>
|
||||
<string>meta.link</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Quotes</string>
|
||||
<key>scope</key>
|
||||
<string>markup.quote</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#10000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Separator</string>
|
||||
<key>scope</key>
|
||||
<string>meta.separator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#13000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inserted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.inserted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Deleted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.deleted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Changed</string>
|
||||
<key>scope</key>
|
||||
<string>markup.changed</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Colors</string>
|
||||
<key>scope</key>
|
||||
<string>constant.other.color</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Regular Expressions</string>
|
||||
<key>scope</key>
|
||||
<string>string.regexp</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Escape Characters</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character.escape</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Embedded</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.section.embedded, variable.interpolation</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Illegal</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.illegal</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#01000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#0f000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Broken</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.broken</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#10000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Deprecated</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.deprecated</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#11000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#0f000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Unimplemented</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.unimplemented</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#08000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#0f000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>uuid</key>
|
||||
<string>uuid</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Vendored
+9
-2
@@ -3,9 +3,16 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
This theme is meant for users who configure their terminal with a base16
|
||||
color theme. If you use a 256-color variant along with base16-shell, use
|
||||
the bat theme base16-256 instead.
|
||||
|
||||
base16: https://github.com/chriskempson/base16
|
||||
base16-shell: https://github.com/chriskempson/base16-shell
|
||||
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||
that this encoding is being used.
|
||||
palette number from 00 to 0f (the 8 colors and their bright versions),
|
||||
and AA is the special value 00 to indicate this encoding is being used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
|
||||
+1
Submodule assets/themes/gruvbox added at e3db74d0e5
Vendored
+1
-1
Submodule assets/themes/onehalf updated: 970abdf26b...3aa42a39ed
@@ -8,6 +8,7 @@ fn main() {}
|
||||
|
||||
#[cfg(feature = "application")]
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
@@ -15,27 +16,32 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Read environment variables.
|
||||
let project_name = option_env!("PROJECT_NAME").unwrap_or("bat");
|
||||
let executable_name = option_env!("PROJECT_EXECUTABLE").unwrap_or(project_name);
|
||||
let executable_name_uppercase = executable_name.to_uppercase();
|
||||
static PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
/// Generates a file from a liquid template.
|
||||
/// Generates a file from a template.
|
||||
fn template(
|
||||
variables: &liquid::Object,
|
||||
variables: &HashMap<&str, &str>,
|
||||
in_file: &str,
|
||||
out_file: impl AsRef<Path>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let template = liquid::ParserBuilder::with_stdlib()
|
||||
.build()?
|
||||
.parse(&fs::read_to_string(in_file)?)?;
|
||||
let mut content = fs::read_to_string(in_file)?;
|
||||
|
||||
fs::write(out_file, template.render(variables)?)?;
|
||||
for (variable_name, value) in variables {
|
||||
// Replace {{variable_name}} by the value
|
||||
let pattern = format!("{{{{{variable_name}}}}}", variable_name = variable_name);
|
||||
content = content.replace(&pattern, value);
|
||||
}
|
||||
|
||||
fs::write(out_file, content)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
let variables = liquid::object!({
|
||||
"PROJECT_NAME": project_name,
|
||||
"PROJECT_EXECUTABLE": executable_name,
|
||||
"PROJECT_VERSION": PROJECT_VERSION,
|
||||
});
|
||||
let mut variables = HashMap::new();
|
||||
variables.insert("PROJECT_NAME", project_name);
|
||||
variables.insert("PROJECT_EXECUTABLE", executable_name);
|
||||
variables.insert("PROJECT_EXECUTABLE_UPPERCASE", &executable_name_uppercase);
|
||||
variables.insert("PROJECT_VERSION", PROJECT_VERSION);
|
||||
|
||||
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
|
||||
let out_dir = Path::new(&out_dir_env);
|
||||
@@ -53,6 +59,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
"assets/completions/bat.fish.in",
|
||||
out_dir.join("assets/completions/bat.fish"),
|
||||
)?;
|
||||
template(
|
||||
&variables,
|
||||
"assets/completions/bat.zsh.in",
|
||||
out_dir.join("assets/completions/bat.zsh"),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Building and packaging for release
|
||||
set -ex
|
||||
|
||||
# Ensure environment variables exist.
|
||||
if [[ -z "$PROJECT_NAME" ]]; then
|
||||
export PROJECT_NAME="bat"
|
||||
fi
|
||||
|
||||
build() {
|
||||
cargo build --bins --target "$TARGET" --release --verbose
|
||||
}
|
||||
|
||||
pack() {
|
||||
local tempdir
|
||||
local out_dir
|
||||
local package_name
|
||||
local gcc_prefix
|
||||
|
||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||
out_dir=$(pwd)
|
||||
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
|
||||
|
||||
if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
|
||||
gcc_prefix="arm-linux-gnueabihf-"
|
||||
elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
|
||||
gcc_prefix="aarch64-linux-gnu-"
|
||||
else
|
||||
gcc_prefix=""
|
||||
fi
|
||||
|
||||
# create a "staging" directory
|
||||
mkdir "$tempdir/$package_name"
|
||||
mkdir "$tempdir/$package_name/autocomplete"
|
||||
|
||||
# copying the main binary
|
||||
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
||||
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
|
||||
|
||||
# manpage, readme and license
|
||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/$package_name/$PROJECT_NAME.1"
|
||||
cp README.md "$tempdir/$package_name"
|
||||
cp LICENSE-MIT "$tempdir/$package_name"
|
||||
cp LICENSE-APACHE "$tempdir/$package_name"
|
||||
|
||||
# various autocomplete
|
||||
# TODO: disabled for now, see issue #372
|
||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
|
||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
|
||||
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/$package_name/autocomplete/$PROJECT_NAME.fish"
|
||||
# cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
|
||||
|
||||
# archiving
|
||||
pushd "$tempdir"
|
||||
tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
|
||||
popd
|
||||
rm -r "$tempdir"
|
||||
}
|
||||
|
||||
make_deb() {
|
||||
local tempdir
|
||||
local architecture
|
||||
local version
|
||||
local dpkgname
|
||||
local conflictname
|
||||
local gcc_prefix
|
||||
local homepage
|
||||
local maintainer
|
||||
|
||||
homepage="https://github.com/sharkdp/bat"
|
||||
maintainer="David Peter <mail@david-peter.de>"
|
||||
|
||||
case $TARGET in
|
||||
x86_64*)
|
||||
architecture=amd64
|
||||
gcc_prefix=""
|
||||
;;
|
||||
i686*)
|
||||
architecture=i386
|
||||
gcc_prefix=""
|
||||
;;
|
||||
aarch64*)
|
||||
architecture=arm64
|
||||
gcc_prefix="aarch64-linux-gnu-"
|
||||
;;
|
||||
arm*hf)
|
||||
architecture=armhf
|
||||
gcc_prefix="arm-linux-gnueabihf-"
|
||||
;;
|
||||
*)
|
||||
echo "make_deb: skipping target '${TARGET}'" >&2
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
version=${TRAVIS_TAG#v}
|
||||
if [[ $TARGET = *musl* ]]; then
|
||||
dpkgname=$PROJECT_NAME-musl
|
||||
conflictname=$PROJECT_NAME
|
||||
else
|
||||
dpkgname=$PROJECT_NAME
|
||||
conflictname=$PROJECT_NAME-musl
|
||||
fi
|
||||
|
||||
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||
|
||||
# copy the main binary
|
||||
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
||||
"${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
|
||||
|
||||
# manpage
|
||||
install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/manual/bat.1 "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||
gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||
|
||||
# completions
|
||||
install -Dm644 target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/assets/completions/bat.fish "$tempdir/usr/share/fish/vendor_completions.d/$PROJECT_NAME.fish"
|
||||
|
||||
# readme and license
|
||||
install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
|
||||
install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
|
||||
install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
|
||||
cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: $PROJECT_NAME
|
||||
Source: $homepage
|
||||
|
||||
Files: *
|
||||
Copyright: $maintainer
|
||||
License: Apache-2.0 or MIT
|
||||
|
||||
License: Apache-2.0
|
||||
On Debian systems, the complete text of the Apache-2.0 can be found in the
|
||||
file /usr/share/common-licenses/Apache-2.0.
|
||||
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
EOF
|
||||
|
||||
# Control file
|
||||
mkdir "$tempdir/DEBIAN"
|
||||
cat > "$tempdir/DEBIAN/control" <<EOF
|
||||
Package: $dpkgname
|
||||
Version: $version
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: $maintainer
|
||||
Homepage: $homepage
|
||||
Architecture: $architecture
|
||||
Provides: $PROJECT_NAME
|
||||
Conflicts: $conflictname
|
||||
Description: A cat(1) clone with wings.
|
||||
A cat(1) clone with syntax highlighting and Git integration.
|
||||
EOF
|
||||
|
||||
fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
build
|
||||
pack
|
||||
if [[ $TARGET = *linux* ]]; then
|
||||
make_deb
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,28 +0,0 @@
|
||||
# This script takes care of packaging the build artifacts that will go in the
|
||||
# release zipfile
|
||||
|
||||
$SRC_DIR = $PWD.Path
|
||||
$STAGE = [System.Guid]::NewGuid().ToString()
|
||||
|
||||
Set-Location $ENV:Temp
|
||||
New-Item -Type Directory -Name $STAGE
|
||||
Set-Location $STAGE
|
||||
|
||||
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
|
||||
|
||||
Copy-Item "$SRC_DIR\target\release\bat.exe" '.\'
|
||||
# TODO: disabled for now, see issue #372
|
||||
# Copy-Item $SRC_DIR\target\release\build\bat-*\out\_bat.ps1 '.\'
|
||||
|
||||
# readme and license
|
||||
Copy-Item $SRC_DIR\README.md '.\'
|
||||
Copy-Item $SRC_DIR\LICENSE-MIT '.\'
|
||||
Copy-Item $SRC_DIR\LICENSE-APACHE '.\'
|
||||
|
||||
7z a "$ZIP" *
|
||||
|
||||
Push-AppveyorArtifact "$ZIP"
|
||||
|
||||
Set-Location ..
|
||||
Remove-Item $STAGE -Force -Recurse
|
||||
Set-Location $SRC_DIR
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
if [ "$TRAVIS_OS_NAME" != linux ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
# needed for musl targets
|
||||
sudo apt-get install -y musl-tools
|
||||
|
||||
# needed to build deb packages
|
||||
sudo apt-get install -y fakeroot
|
||||
|
||||
# needed for i686 linux gnu target
|
||||
if [[ $TARGET == i686-unknown-linux-gnu ]]; then
|
||||
sudo apt-get install -y gcc-multilib
|
||||
fi
|
||||
|
||||
# needed for cross-compiling for arm
|
||||
if [[ $TARGET == arm-unknown-linux-gnueabihf ]]; then
|
||||
sudo apt-get install -y \
|
||||
gcc-4.8-arm-linux-gnueabihf \
|
||||
binutils-arm-linux-gnueabihf \
|
||||
libc6-armhf-cross \
|
||||
libc6-dev-armhf-cross
|
||||
fi
|
||||
|
||||
# needed for cross-compiling for arm64
|
||||
if [[ $TARGET == aarch64-unknown-linux-gnu ]]; then
|
||||
sudo apt-get install -y \
|
||||
gcc-4.8-aarch64-linux-gnu \
|
||||
binutils-aarch64-linux-gnu \
|
||||
gcc-aarch64-linux-gnu \
|
||||
libc6-dev-arm64-cross
|
||||
fi
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
# Incorporate TARGET env var to the build and test process
|
||||
cargo build --target "$TARGET" --verbose
|
||||
|
||||
# We cannot run arm executables on linux
|
||||
if [[ $TARGET != arm-unknown-linux-gnueabihf ]] && [[ $TARGET != aarch64-unknown-linux-gnu ]]; then
|
||||
cargo test --target "$TARGET" --verbose
|
||||
|
||||
# Run 'bat' on its own source code and the README
|
||||
cargo run --target "$TARGET" -- src/bin/bat/main.rs README.md --paging=never
|
||||
fi
|
||||
|
||||
# Check bat-as-a-library, which has a smaller set of dependencies
|
||||
cargo check --target "$TARGET" --verbose --lib --no-default-features --features regex-onig
|
||||
cargo check --target "$TARGET" --verbose --lib --no-default-features --features regex-onig,git
|
||||
cargo check --target "$TARGET" --verbose --lib --no-default-features --features regex-onig,paging
|
||||
cargo check --target "$TARGET" --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||
Vendored
+1
-1
@@ -58,7 +58,7 @@ _bat_:run() {
|
||||
_out "$BAT" --version
|
||||
_out env | grep '^BAT_\|^PAGER='
|
||||
|
||||
local cache_dir="$(bat --cache-dir)"
|
||||
local cache_dir="$($BAT --cache-dir)"
|
||||
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
||||
_print_command "$BAT" "--list-languages"
|
||||
echo "Found custom syntax set."
|
||||
|
||||
+29
-20
@@ -43,14 +43,14 @@
|
||||
|
||||
### ファイルの連結
|
||||
|
||||
あなたはさらにファイルを連結させるに使うことも可能です:wink:。
|
||||
あなたはさらにファイルを連結させるために使うことも可能です:wink:。
|
||||
`bat` は非対話型のターミナルを検出すると、
|
||||
いつでも `cat` の完全互換として振る舞い、
|
||||
プレーンなファイルを表示します。
|
||||
|
||||
## 使い方
|
||||
|
||||
単一のファイルを表示させたい
|
||||
単一のファイルを表示させたい場合
|
||||
|
||||
```bash
|
||||
> bat README.md
|
||||
@@ -119,8 +119,7 @@ batgrep needle src/
|
||||
```bash
|
||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||
```
|
||||
Note that we have to switch off paging in order for this to work. We have also specified the syntax
|
||||
explicitly (`-l log`), as it can not be auto-detected in this case.
|
||||
注意事項:`tail -f`と組み合わせるには、ページングをオフにしなければなりません。また、この場合は構文が自動検出されないため、明示的に指定(`-l log`)しています。
|
||||
|
||||
#### `git`
|
||||
|
||||
@@ -168,19 +167,29 @@ man 2 select
|
||||
|
||||
[](https://repology.org/project/bat/versions)
|
||||
|
||||
### On Ubuntu
|
||||
### On Ubuntu (`apt` を使用)
|
||||
*... や他のDebianベースのLinuxディストリビューション*
|
||||
|
||||
Ubuntu Eoan 19.10 または Debian 不安定版 sid 以降の [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) または [the Debian `bat` package](https://packages.debian.org/sid/bat) をインストールできます:
|
||||
Ubuntu Eoan 19.10 または Debian 不安定版 sid 以降の [the Ubuntu `bat` package](https://packages.ubuntu.com/eoan/bat) または [the Debian `bat` package](https://packages.debian.org/sid/bat) からインストールできます:
|
||||
|
||||
```bash
|
||||
apt install bat
|
||||
```
|
||||
|
||||
`apt` を使用して `bat` をインストールした場合、実行可能ファイルの名前が `bat` ではなく `batcat` になることがあります([他のパッケージとの名前衝突のため](https://github.com/sharkdp/bat/issues/982))。`bat -> batcat` のシンボリックリンクまたはエイリアスを設定することで、実行可能ファイル名が異なることによる問題の発生を防ぎ、他のディストリビューションと一貫性を保てます。
|
||||
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
### On Ubuntu (最新の `.deb` パッケージを使用)
|
||||
*... や他のDebianベースのLinuxディストリビューション
|
||||
|
||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||
次の方法でインストールします:
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.2_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.16.0_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -220,7 +229,7 @@ emerge sys-apps/bat
|
||||
|
||||
### On Void Linux
|
||||
|
||||
xbps-ininstall経由で `bat` をインストールできます。
|
||||
xbps-install経由で `bat` をインストールできます。
|
||||
```
|
||||
xbps-install -S bat
|
||||
```
|
||||
@@ -233,7 +242,7 @@ pkg を使用してプリコンパイルされた [`bat` package](https://www.fr
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
または FreeBSD ポートから自分でビルドする:
|
||||
または FreeBSD ポートから自分でビルドすることもできます:
|
||||
|
||||
```bash
|
||||
cd /usr/ports/textproc/bat
|
||||
@@ -336,13 +345,13 @@ ansible-galaxy install aeimer.install_bat
|
||||
### From binaries
|
||||
|
||||
|
||||
多くの異なるアーキテクチャのためのプレビルドバージョンを[リリースページ](https://github.com/sharkdp/bat/releases)からチェックしてみてください。静的にリンクされている多くのバイナリも利用できます: ファイル名に `musl` を含むアーカイブを探します。
|
||||
多くの異なるアーキテクチャのためのプレビルドバージョンを[リリースページ](https://github.com/sharkdp/bat/releases)からチェックしてみてください。静的にリンクされている多くのバイナリも利用できます: ファイル名に `musl` を含むアーカイブを探してみてください。
|
||||
|
||||
### From source
|
||||
|
||||
|
||||
`bat` をソースからビルドしたいならば、Rust 1.36 以上の環境が必要です。
|
||||
そして `cargo` をビルドに対して使用します:
|
||||
`cargo` を使用してビルドすることができます:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
@@ -387,7 +396,7 @@ bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||
[Sublime Text の `.sublime-syntax` ファイル](https://www.sublimetext.com/docs/3/syntax.html)
|
||||
とテーマを読み取ることができます。新しい構文を定義するために以下の手順を行います。
|
||||
|
||||
構文定義ファイルを入れておくためのフォルダを作る:
|
||||
構文定義ファイルを入れておくためのフォルダを作ります:
|
||||
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||
@@ -428,13 +437,13 @@ git clone https://github.com/greggb/sublime-snazzy
|
||||
bat cache --build
|
||||
```
|
||||
|
||||
最後に、 `bat --list-themes` で新しいテーマが利用可能がチェックします
|
||||
最後に、 `bat --list-themes` で新しいテーマが利用可能かチェックします
|
||||
|
||||
### 異なるページャーの使用
|
||||
|
||||
`bat` は環境変数 `PAGER` に使用するページャーを明記します。
|
||||
この環境変数が定義されていない場合、デフォルトで `less` が使用されます。
|
||||
もし、異なるページャーが使用したい場合は、`PAGER` を修正してください。
|
||||
もし、異なるページャーを使用したい場合は、`PAGER` を修正してください。
|
||||
または、`PAGER` を上書きする環境変数として `BAT_PAGER` を定義することも可能です。
|
||||
|
||||
もし、ページャーにコマンドライン引数を渡したい場合は、
|
||||
@@ -526,14 +535,14 @@ Windows 10では、`conhost.exe` (コマンドプロンプト)と
|
||||
[ConEmu](https://conemu.github.io/) を含む [Cmder](http://cmder.net/) を使用できます。
|
||||
|
||||
**注意:** Git と MSYS の `less` はWindows上で色を正しく解釈しません。
|
||||
もし、あなたが他のページャーをインストールしていないのであれば、 `--paging=never` オプションを付け加える
|
||||
または `BAT_PAGER` に空文字を設定することでページングを完全に無効にできます。
|
||||
もし、あなたが他のページャーをインストールしていないのであれば、 `--paging=never` オプションを付け加えるか
|
||||
`BAT_PAGER` に空文字を設定することでページングを完全に無効にできます。
|
||||
|
||||
### Cygwin
|
||||
|
||||
Windows上の `bat` は Cygwin のunix風のpath(`/cygdrive/*`)をネイティブサポートしていません。絶対的なcygwinパスを引数として受けたときに、 `bat` は以下のエラーを返すでしょう: `The system cannot find the path specified. (os error 3)`
|
||||
|
||||
wrapperを作成するまたは以下の関数を `.bash_profile` に追記することでこの問題を解決することができます:
|
||||
wrapperを作成するか、以下の関数を `.bash_profile` に追記することで、この問題を解決することができます:
|
||||
|
||||
```bash
|
||||
bat() {
|
||||
@@ -553,7 +562,7 @@ bat() {
|
||||
|
||||
### ターミナルと色
|
||||
|
||||
`bat` はターミナルがトゥルーカラーをサポートしている/していない関係なくサポートします。
|
||||
`bat` はターミナルがトゥルーカラーをサポートしている/していないに関係なくサポートします。
|
||||
しかし、シンタックスハイライトのテーマの色が8-bitカラーに最適化されていない場合、
|
||||
24-bitであるトゥルーカラーをサポートしているターミナルを使用することを強く推奨します(`terminator`, `konsole`, `iTerm2`, ...)。
|
||||
この [記事](https://gist.github.com/XVilka/8346728) には
|
||||
@@ -610,10 +619,10 @@ cargo install --locked --force
|
||||
|
||||
`bat` は以下の目標を達成しようと試みています:
|
||||
|
||||
- 美しい高度なシンタックスハイライトの提供
|
||||
- 美しく高度なシンタックスハイライトの提供
|
||||
- ファイルの差分を表示するためのGitとの連携
|
||||
- (POSIX) `cat` との完全互換
|
||||
- ユーザーフレンドリーがコマンドラインインターフェースの提供
|
||||
- ユーザーフレンドリーなコマンドラインインターフェースの提供
|
||||
|
||||
あなたが同様のプログラムを探しているなら、多くの選択肢があります。
|
||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ apt install bat
|
||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.15.2_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.16.0_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
|
||||
@@ -0,0 +1,594 @@
|
||||
<p align="center">
|
||||
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
||||
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf/branch/master?svg=true"></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
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#выделение-синтаксиса">Ключевые возможности</a> •
|
||||
<a href="#как-использовать">Использование</a> •
|
||||
<a href="#установка">Установка</a> •
|
||||
<a href="#кастомизация">Кастомизация</a> •
|
||||
<a href="#цели-и-альтернативы">Цели и альтернативы </a> •
|
||||
Перевод [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>][<a href="doc/README-ja.md">日本語</a>][<a href="doc/README-ko.md">한국어</a>][<a href="doc/README-ru.md">Русский</a>]
|
||||
</p>
|
||||
|
||||
### Выделение синтаксиса
|
||||
|
||||
`bat` поддерживает выделение синтаксиса для огромного количества языков программирования и разметки:
|
||||
|
||||

|
||||
|
||||
### Интеграция с Git
|
||||
`bat` использует `git`, чтобы показать изменения в коде
|
||||
(смотрите на левый сайдбар):
|
||||
|
||||

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

|
||||
|
||||
### Автоматическое разделение текста
|
||||
|
||||
`bat` умеет перенаправлять вывод в `less`, если вывод не помещается на экране полностью.
|
||||
|
||||
### Объединение файлов
|
||||
|
||||
О... Вы также можете объединять файлы :wink:. Когда
|
||||
`bat` обнаружит неинтерактивный терминал (например, когда вы перенаправляете вывод в файл или процесс), он будет работать как утилита `cat` и выведет содержимое файлов как обычный текст (без подсветки синтаксиса).
|
||||
|
||||
## Как использовать
|
||||
|
||||
Вывести единственный файл в терминале
|
||||
|
||||
```bash
|
||||
> bat README.md
|
||||
```
|
||||
|
||||
Отобразить сразу несколько файлов в терминале
|
||||
|
||||
```bash
|
||||
> bat src/*.rs
|
||||
```
|
||||
|
||||
Читаем из stdin и определяем синтаксис автоматически (внимание: это делается по заглавной строке файла, например, `#!/bin/sh`)
|
||||
|
||||
```bash
|
||||
> curl -s https://sh.rustup.rs | bat
|
||||
```
|
||||
|
||||
Прочитать из stdin с явным указанием языка
|
||||
|
||||
```bash
|
||||
> yaml2json .travis.yml | json_pp | bat -l json
|
||||
```
|
||||
|
||||
Вывести и выделить неотображаемые символы
|
||||
```bash
|
||||
> bat -A /etc/hosts
|
||||
```
|
||||
|
||||
Использование в качестве замены `cat`
|
||||
|
||||
```bash
|
||||
bat > note.md # мгновенно создаем новый файл
|
||||
|
||||
bat header.md content.md footer.md > document.md
|
||||
|
||||
bat -n main.rs # показываем только количество строк
|
||||
|
||||
bat f - g # выводит 'f' в stdin, а потом 'g'.
|
||||
```
|
||||
|
||||
### Интеграция с другими утилитами
|
||||
|
||||
#### `find` или `fd`
|
||||
|
||||
Вы можете использовать флаг `-exec` в `find`, чтобы посмотреть превью всех файлов в `bat`
|
||||
```bash
|
||||
find … -exec bat {} +
|
||||
```
|
||||
|
||||
Если вы используете [`fd`](https://github.com/sharkdp/fd), применяйте для этого флаг `-X`/`--exec-batch`:
|
||||
```bash
|
||||
fd … -X bat
|
||||
```
|
||||
|
||||
#### `ripgrep`
|
||||
|
||||
С помощью [`batgrep`](https://github.com/eth-p/bat-extras/blob/master/doc/batgrep.md), `bat` может быть использован для вывода результата запроса [`ripgrep`](https://github.com/BurntSushi/ripgrep)
|
||||
|
||||
```bash
|
||||
batgrep needle src/
|
||||
```
|
||||
|
||||
#### `tail -f`
|
||||
|
||||
`bat` может быть использован вместе с `tail -f`, чтобы выводить содержимое файла с подсветкой синтаксиса в реальном времени.
|
||||
```bash
|
||||
tail -f /var/log/pacman.log | bat --paging=never -l log
|
||||
```
|
||||
Заметьте, что мы должны отключить пэйджинг, чтобы это заработало. Мы также явно указали синтаксис (`-l log`), так как он не может быть автоматически определен в данном случае.
|
||||
|
||||
#### `git`
|
||||
|
||||
Вы можете использовать `bat` с `git show`, чтобы просмотреть старую версию файла с выделением синтаксиса:
|
||||
```bash
|
||||
git show v0.6.0:src/main.rs | bat -l rs
|
||||
```
|
||||
|
||||
Обратите внимание, что выделение синтаксиса не работает в `git diff` на данный момент. Если вам это нужно, посмотрите [`delta`](https://github.com/dandavison/delta).
|
||||
|
||||
#### `xclip`
|
||||
|
||||
Нумерация стро и отображение изменений затрудняет копирование содержимого файлов в буфер обмена.
|
||||
Чтобы спроваиться с этим, используйте флаг `-p`/`--plain` или просто перенаправьте стандартный вывод в `xclip`:
|
||||
```bash
|
||||
bat main.cpp | xclip
|
||||
```
|
||||
`bat` обнаружит перенаправление вывода и выведет обычный текст без выделения синтаксиса.
|
||||
|
||||
#### `man`
|
||||
|
||||
`bat` может быть использован в виде выделения цвета для `man`, для этого установите переменную окружения
|
||||
`MANPAGER`:
|
||||
|
||||
```bash
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
|
||||
Возможно вам понадобится также установить `MANROFFOPT="-c"`, если у вас есть проблемы с форматированием.
|
||||
|
||||
Если вы хотите сделать этой одной командой, вы можете использовать [`batman`](https://github.com/eth-p/bat-extras/blob/master/doc/batman.md).
|
||||
|
||||
Обратите внимание, что [синтаксис manpage](assets/syntaxes/02_Extra/Manpage.sublime-syntax) разрабатывается в этом репозитории и все еще находится в разработке.
|
||||
|
||||
#### `prettier` / `shfmt` / `rustfmt`
|
||||
|
||||
[`Prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) — скрипт, который форматирует код и выводит его с помощью `bat`.
|
||||
|
||||
|
||||
## Установка
|
||||
|
||||
[](https://repology.org/project/bat/versions)
|
||||
|
||||
### Ubuntu (с помощью `apt`)
|
||||
*... и другие дистрибутивы основанные на Debian.*
|
||||
|
||||
`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` так:
|
||||
|
||||
```bash
|
||||
apt install bat
|
||||
```
|
||||
|
||||
Если вы установили `bat` таким образом, то бинарный файл может быть установлен как `batcat` вместо `bat` (из-за [конфликта имени с другим пакетом](https://github.com/sharkdp/bat/issues/982)). Вы можете сделать симлинк или алиас `bat -> batcat`, чтобы предотвратить подобные проблемы и в других дистрибутивах.
|
||||
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
```
|
||||
|
||||
### Ubuntu (С помощью самого нового `.deb` пакета)
|
||||
*... и другие дистрибутивы Linux основанные на Debian*
|
||||
|
||||
Если пакет еще недоступен в вашем Ubuntu/Debian дистрибутиве или вы хотите установить самую последнюю версию `bat`, то вы можете скачать самый последний `deb`-пакет отсюда:
|
||||
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.16.0_amd64.deb # измените архитектуру и версию
|
||||
```
|
||||
|
||||
### Alpine Linux
|
||||
|
||||
Вы можете установить [`bat`](https://pkgs.alpinelinux.org/packages?name=bat) из официальных источников:
|
||||
|
||||
```bash
|
||||
apk add bat
|
||||
```
|
||||
|
||||
### Arch Linux
|
||||
|
||||
Вы можете установить [`bat`](https://www.archlinux.org/packages/community/x86_64/bat/) из официального источника:
|
||||
|
||||
```bash
|
||||
pacman -S bat
|
||||
```
|
||||
|
||||
### Fedora
|
||||
|
||||
Вы можете установить [`bat`](https://koji.fedoraproject.org/koji/packageinfo?packageID=27506) из официального репозитория [Fedora Modular](https://docs.fedoraproject.org/en-US/modularity/using-modules/).
|
||||
|
||||
```bash
|
||||
dnf install bat
|
||||
```
|
||||
|
||||
### Gentoo Linux
|
||||
|
||||
Вы можете установить [`bat`](https://packages.gentoo.org/packages/sys-apps/bat) из официальных источников:
|
||||
|
||||
```bash
|
||||
emerge sys-apps/bat
|
||||
```
|
||||
|
||||
### Void Linux
|
||||
|
||||
Вы можете установить `bat` с помощью `xbps-install`:
|
||||
```bash
|
||||
xbps-install -S bat
|
||||
```
|
||||
|
||||
### FreeBSD
|
||||
|
||||
Вы можете установить [`bat`](https://www.freshports.org/textproc/bat) с помощью `pkg`:
|
||||
|
||||
```bash
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
или самому скомпилировать его:
|
||||
|
||||
```bash
|
||||
cd /usr/ports/textproc/bat
|
||||
make install
|
||||
```
|
||||
|
||||
### С помощью nix
|
||||
|
||||
Вы можете установить `bat`, используя [nix package manager](https://nixos.org/nix):
|
||||
|
||||
```bash
|
||||
nix-env -i bat
|
||||
```
|
||||
|
||||
### openSUSE
|
||||
|
||||
Вы можете установить `bat` с помощью `zypper`:
|
||||
|
||||
```bash
|
||||
zypper install bat
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
Вы можете установить `bat` с помощью [Homebrew](http://braumeister.org/formula/bat):
|
||||
|
||||
```bash
|
||||
brew install bat
|
||||
```
|
||||
|
||||
Или же установить его с помощью [MacPorts](https://ports.macports.org/port/bat/summary):
|
||||
|
||||
```bash
|
||||
port install bat
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
Есть несколько способов установить `bat`. Как только вы установили его, посмотрите на секцию ["Использование `bat` в Windows"](#using-bat-on-windows).
|
||||
|
||||
#### С помощью Chocolatey
|
||||
|
||||
Вы можете установить `bat` с помощью [Chocolatey](https://chocolatey.org/packages/Bat):
|
||||
```bash
|
||||
choco install bat
|
||||
```
|
||||
|
||||
#### С помощью Scoop
|
||||
|
||||
Вы можете установить `bat` с помощью [scoop](https://scoop.sh/):
|
||||
```bash
|
||||
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) для
|
||||
скомпилированных файлов `bat` для различных платформ. Бинарные файлы со статической связкой так же доступны: выбирайте архив с `musl` в имени.
|
||||
|
||||
### Из исходников
|
||||
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.40 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
```
|
||||
|
||||
## Кастомизация
|
||||
|
||||
### Темы для выделения текста
|
||||
|
||||
Используйте `bat --list-themes`, чтобы вывести список всех доступных тем. Для выбора темы `TwoDark` используйте `bat` с флагом
|
||||
`--theme=TwoDark` или выставьте переменную окружения `BAT_THEME` в `TwoDark`. Используйте `export BAT_THEME="TwoDark"` в конфигурационном файле вашей оболочки, чтобы изменить ее навсегда. Или же используйте [конфигурационный файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
|
||||
|
||||
Если вы хотите просто просмотреть темы, используйте следующую команду (для этого вам понадобится [`fzf`](https://github.com/junegunn/fzf)):
|
||||
```bash
|
||||
bat --list-themes | fzf --preview="bat --theme={} --color=always /путь/к/файлу"
|
||||
```
|
||||
|
||||
`bat` отлично смотрится на темном фоне. Однако если ваш терминал использует светлую тему, то такие темы как `GitHub` или `OneHalfLight` будут смотреться куда лучше!
|
||||
Вы также можете использовать новую тему, для этого перейдите [в раздел добавления тем](https://github.com/sharkdp/bat#добавление-новых-тем).
|
||||
|
||||
### Изменение внешнего вывода
|
||||
|
||||
Вы можете использовать флаг `--style`, чтобы изменять внешний вид вывода в `bat`.
|
||||
Например, вы можете использовать `--style=numbers,changes`, чтобы показать только количество строк и изменений в Git. Установите переменную окружения `BAT_STYLE` чтобы изменить это навсегда, или используйте [конфиг файл](https://github.com/sharkdp/bat#configuration-file) `bat`.
|
||||
|
||||
### Добавление новых синтаксисов
|
||||
|
||||
`bat` использует [`syntect`](https://github.com/trishume/syntect/) для выделения синтаксиса. `syntect` может читать
|
||||
[файл `.sublime-syntax`](https://www.sublimetext.com/docs/3/syntax.html)
|
||||
и темы. Чтобы добавить новый синтаксис, сделайте следующее:
|
||||
|
||||
Создайте каталог с синтаксисом:
|
||||
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/syntaxes"
|
||||
cd "$(bat --config-dir)/syntaxes"
|
||||
|
||||
# Разместите файлы '.sublime-syntax'
|
||||
# в каталоге (или субкаталогах), например:
|
||||
git clone https://github.com/tellnobody1/sublime-purescript-syntax
|
||||
```
|
||||
|
||||
Теперь используйте следующую команду, чтобы превратить эти файлы в бинарный кеш:
|
||||
|
||||
```bash
|
||||
bat cache --build
|
||||
```
|
||||
|
||||
Теперь вы можете использовать `bat --list-languages`, чтобы проверить, доступны ли новые языки.
|
||||
|
||||
Если когда-нибудь вы заходите вернуться к настройкам по умолчанию, введите
|
||||
|
||||
```bash
|
||||
bat cache --clear
|
||||
```
|
||||
|
||||
### Добавление новых тем
|
||||
|
||||
Это работает похожим образом, так же как и добавление новых тем выделения синтаксиса
|
||||
|
||||
Во-первых, создайте каталог с новыми темами для синтаксиса:
|
||||
```bash
|
||||
mkdir -p "$(bat --config-dir)/themes"
|
||||
cd "$(bat --config-dir)/themes"
|
||||
|
||||
# Загрузите тему в формате '.tmTheme':
|
||||
git clone https://github.com/greggb/sublime-snazzy
|
||||
|
||||
# Обновите кеш
|
||||
bat cache --build
|
||||
```
|
||||
|
||||
Теперь используйте `bat --list-themes`, чтобы проверить доступность новых тем.
|
||||
|
||||
### Использование другого пейджера.
|
||||
|
||||
`bat` использует пейджер, указанный в переменной окружения `PAGER`. Если она не задана, то используется `less`.
|
||||
Если вы желаете использовать другой пейджер, вы можете либо изменить переменную `PAGER`, либо `BAT_PAGER` чтобы перезаписать то, что указано в `PAGER`.
|
||||
|
||||
Чтобы передать дополнительные аргументы вашему пейджеру, перечислите их в этой переменной:
|
||||
|
||||
```bash
|
||||
export BAT_PAGER="less -RF"
|
||||
```
|
||||
|
||||
Так же вы можете использовать [файл конфигурации](https://github.com/sharkdp/bat#configuration-file) `bat` (флаг `--pager`).
|
||||
|
||||
**Внимание**: По умолчанию пейджером является`less` (без каких-либо аргументов),
|
||||
`bat` задаст следующие флаги для пейджера:
|
||||
`-R`/`--RAW-CONTROL-CHARS`,
|
||||
`-F`/`--quit-if-one-screen` и `-X`/`--no-init`. Последний флаг(`-X`) используется только для `less`, чья версия раньше 530.
|
||||
|
||||
Флаг `-R` нужен чтобы корректно воспроизвести ANSI цвета. Второй флаг (`-F`) говорит
|
||||
`less` чтобы тот сразу же завершился, если размер вывода меньше чем вертикальный размер терминала.
|
||||
Это удобно для небольших файлов, так как вам не надо каждый раз нажимать `q`, чтобы выйти из пейджера. Третий флаг (`-X`) нужен для того, чтобы исправить баг с `--quit-if-one-screen` в старых версиях `less`. К сожалению, это блокирует возможность использования колеса мышки.
|
||||
|
||||
Если вы хотите все же его включить, вы можете добавить флаг `-R`.
|
||||
Для `less` новее чем 530 оно должно работать из коробки.
|
||||
|
||||
### Темная тема
|
||||
|
||||
Если вы используете темный режим в macOS, возможно вы захотите чтобы `bat` использовал другую тему, основанную на теме вашей ОС. Следующий сниппет использует тему `default`, когда у вас включен темный режим, и тему `GitHub`, когда включен светлый.
|
||||
|
||||
```bash
|
||||
alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo default || echo GitHub)"
|
||||
```
|
||||
|
||||
## Файл конфигурации
|
||||
|
||||
`bat` также может быть кастомизирован с помощью файла конфигурации. Его местоположение зависит от вашей ОС: чтобы посмотреть его путь, введите
|
||||
```
|
||||
bat --config-file
|
||||
```
|
||||
|
||||
Также вы можете установить переменную окружения `BAT_CONFIG_PATH`, чтобы изменить путь к файлу конфигурации.
|
||||
```bash
|
||||
export BAT_CONFIG_PATH="/path/to/bat.conf"
|
||||
```
|
||||
|
||||
Файл конфигурации «по умолчанию» может быть создан с помощью флага `--generate-config-file`.
|
||||
```bash
|
||||
bat --generate-config-file
|
||||
```
|
||||
|
||||
### Формат
|
||||
|
||||
Файл конфигурации - это всего лишь набор аргументов. Введите `bat --help`, чтобы просмотреть список всех возможных флагов и аргументов. Также вы можете закомментировать строку с помощью `#`.
|
||||
|
||||
Пример файла конфигурации:
|
||||
```bash
|
||||
# Установить тему "TwoDark"
|
||||
--theme="TwoDark"
|
||||
|
||||
# Показывать количество строк, изменений в Git и заголовок файла
|
||||
--style="numbers,changes,header"
|
||||
|
||||
# Использовать курсив (поддерживается не всеми терминалами)
|
||||
--italic-text=always
|
||||
|
||||
# Использовать синтаксис C++ для всех .ino файлов
|
||||
--map-syntax "*.ino:C++"
|
||||
|
||||
# Использовать синтаксик Git Ignore для всех файлов .ignore
|
||||
--map-syntax ".ignore:Git Ignore"
|
||||
```
|
||||
|
||||
## Использование `bat` в Windows
|
||||
|
||||
`bat` полностью работоспособен "из коробки", но для некоторых возможностей могут понадобиться дополнительные настройки.
|
||||
|
||||
### Пейджинг
|
||||
|
||||
Windows поддерживает только очень простой пейджер `more`. Вы можете скачать установщик для `less` [с его сайта](http://www.greenwoodsoftware.com/less/download.html) или [через Chocolatey](https://chocolatey.org/packages/Less). Чтобы его использовать, скопируйте исполняемый файл в ваш `PATH` или [используйте переменную окружения](#Использование-другого-пейджера). [Пакет из Chocolatey](#windows) установит все автоматически.
|
||||
|
||||
### Цвета
|
||||
|
||||
Windows 10 поддерживает цвета и в `conhost.exe` (Command Prompt), и в PowerShell начиная с версии Windows
|
||||
[v1511](https://ru.wikipedia.org/wiki/Windows_10#Обновления и поддержка), так же как и в bash. На ранних версиях Windows вы можете использовать
|
||||
[Cmder](http://cmder.net/), в котором есть [ConEmu](https://conemu.github.io/).
|
||||
|
||||
**Внимание:** Версия `less` в Git и MSYS2 воспроизводит цвета некорректно. Если у вас нет других пейджеров, мы можете отключить использование пейджеров с помощью флага `--paging=never`
|
||||
или установить `BAT_PAGER` равным пустой строке.
|
||||
|
||||
### Cygwin
|
||||
|
||||
Из коробки `bat` не поддерживает пути в стиле Unix (`/cygdrive/*`). Когда указан абсолютный путь cygwin, `bat` выдаст следующую ошибку: `The system cannot find the path specified. (os error 3)`
|
||||
|
||||
Она может быть решена добавлением следующей функции в `.bash_profile`:
|
||||
|
||||
```bash
|
||||
bat() {
|
||||
local index
|
||||
local args=("$@")
|
||||
for index in $(seq 0 ${#args[@]}) ; do
|
||||
case "${args[index]}" in
|
||||
-*) continue;;
|
||||
*) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
|
||||
esac
|
||||
done
|
||||
command bat "${args[@]}"
|
||||
}
|
||||
```
|
||||
|
||||
## Проблемы и их решение
|
||||
|
||||
### Терминалы и цвета
|
||||
|
||||
`bat` поддерживает терминалы *с* и *без* поддержки truecolor. Однако подсветка синтаксиса не оптимизирована для терминалов с 8-битными цветами, и рекомендуется использовать терминалы с поддержкой 24-битных цветов (`terminator`, `konsole`, `iTerm2`, ...).
|
||||
Смотрите [эту статью](https://gist.github.com/XVilka/8346728) для полного списка терминалов.
|
||||
|
||||
Удостовертесь, что переменная `COLORTERM` равна `truecolor` или
|
||||
`24bit`. Иначе `bat` не сможет определить поддержку 24-битных цветов (и будет использовать 8-битные).
|
||||
|
||||
### Текст и номера строк плохо видны
|
||||
|
||||
Используйте другую тему (`bat --list-themes` выведет список всех установленных тем). Темы `OneHalfDark` и
|
||||
`OneHalfLight` имеют более яркие номера строк и тексты.
|
||||
|
||||
### Кодировки файлов
|
||||
|
||||
`bat` поддерживает UTF-8 и UTF-16. Файлы в других кодировках, возможно, придётся перекодировать, так как кодировка может быть распознана неверно. Используйте `iconv`.
|
||||
Пример: у вас есть PHP файл в кодировке Latin-1 (ISO-8859-1):
|
||||
``` bash
|
||||
iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
||||
```
|
||||
Внимание: вам может понадобится флаг `-l`/`--language`, если `bat` не сможет автоматически определить синтаксис.
|
||||
|
||||
## Разработка
|
||||
|
||||
```bash
|
||||
# Рекурсивно клонирует все модули
|
||||
git clone --recursive https://github.com/sharkdp/bat
|
||||
|
||||
# Компиляции в режиме разработки
|
||||
cd bat
|
||||
cargo build --bins
|
||||
|
||||
# Запуск тестов
|
||||
cargo test
|
||||
|
||||
# Установка (релизная версия)
|
||||
cargo install --locked
|
||||
|
||||
# Компилирование исполняего файла bat с другим синтаксисом и темами
|
||||
bash assets/create.sh
|
||||
cargo install --locked --force
|
||||
```
|
||||
|
||||
## Разработчики
|
||||
|
||||
- [sharkdp](https://github.com/sharkdp)
|
||||
- [eth-p](https://github.com/eth-p)
|
||||
|
||||
## Цели и альтернативы
|
||||
|
||||
Цели проекта `bat`:
|
||||
|
||||
- Красивая и продвинутая подсветка синтаксиса.
|
||||
- Интеграция с Git.
|
||||
- Полноценная замена `cat`.
|
||||
- Дружелюбный интерфейс и аргументы.
|
||||
|
||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||
|
||||
## Лицензия
|
||||
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||
|
||||
Смотрите [LICENSE-APACHE](LICENSE-APACHE) и [LICENSE-MIT](LICENSE-MIT) для более подробного ознакомления.
|
||||
@@ -0,0 +1,19 @@
|
||||
/// A small demonstration of the Input API.
|
||||
/// This prints embedded bytes with a custom header and then reads from STDIN.
|
||||
use bat::{Input, PrettyPrinter};
|
||||
|
||||
fn main() {
|
||||
PrettyPrinter::new()
|
||||
.header(true)
|
||||
.grid(true)
|
||||
.line_numbers(true)
|
||||
.inputs(vec![
|
||||
Input::from_bytes(b"echo 'Hello World!'")
|
||||
.name("embedded.sh") // Dummy name provided to detect the syntax.
|
||||
.kind("Embedded")
|
||||
.title("An embedded shell script."),
|
||||
Input::from_stdin().title("Standard Input").kind("FD"),
|
||||
])
|
||||
.print()
|
||||
.unwrap();
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/// A program that serializes a Rust structure to YAML and pretty-prints the result
|
||||
use bat::PrettyPrinter;
|
||||
use bat::{Input, PrettyPrinter};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -29,7 +29,7 @@ fn main() {
|
||||
.line_numbers(true)
|
||||
.grid(true)
|
||||
.header(true)
|
||||
.input_from_bytes_with_name(&bytes, "person.yaml")
|
||||
.input(Input::from_bytes(&bytes).name("person.yaml").kind("File"))
|
||||
.print()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
+23
-8
@@ -8,7 +8,7 @@ use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
||||
use syntect::highlighting::{Theme, ThemeSet};
|
||||
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
||||
|
||||
use path_absolutize::Absolutize;
|
||||
use path_abs::PathAbs;
|
||||
|
||||
use crate::assets_metadata::AssetsMetadata;
|
||||
use crate::error::*;
|
||||
@@ -170,6 +170,21 @@ impl HighlightingAssets {
|
||||
self.theme_set.themes.keys().map(|s| s.as_ref())
|
||||
}
|
||||
|
||||
pub fn syntax_for_file_name(
|
||||
&self,
|
||||
file_name: impl AsRef<Path>,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Option<&SyntaxReference> {
|
||||
let file_name = file_name.as_ref();
|
||||
match mapping.get_syntax_for(file_name) {
|
||||
Some(MappingTarget::MapToUnknown) => None,
|
||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
||||
self.syntax_set.find_syntax_by_name(syntax_name)
|
||||
}
|
||||
None => self.get_extension_syntax(file_name.as_os_str()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_theme(&self, theme: &str) -> &Theme {
|
||||
match self.theme_set.themes.get(theme) {
|
||||
Some(theme) => theme,
|
||||
@@ -193,11 +208,7 @@ impl HighlightingAssets {
|
||||
input: &mut OpenedInput,
|
||||
mapping: &SyntaxMapping,
|
||||
) -> Result<&SyntaxReference> {
|
||||
if input.kind.is_theme_preview_file() {
|
||||
self.syntax_set
|
||||
.find_syntax_by_name("Rust")
|
||||
.ok_or_else(|| ErrorKind::UnknownSyntax("Rust".to_owned()).into())
|
||||
} else if let Some(language) = language {
|
||||
if let Some(language) = language {
|
||||
self.syntax_set
|
||||
.find_syntax_by_token(language)
|
||||
.ok_or_else(|| ErrorKind::UnknownSyntax(language.to_owned()).into())
|
||||
@@ -220,7 +231,10 @@ impl HighlightingAssets {
|
||||
if let Some(path_str) = path_str {
|
||||
// If a path was provided, we try and detect the syntax based on extension mappings.
|
||||
let path = Path::new(path_str);
|
||||
let absolute_path = path.absolutize().ok().unwrap_or_else(|| path.to_owned());
|
||||
let absolute_path = PathAbs::new(path)
|
||||
.ok()
|
||||
.map(|p| p.as_path().to_path_buf())
|
||||
.unwrap_or_else(|| path.to_owned());
|
||||
|
||||
match mapping.get_syntax_for(absolute_path) {
|
||||
Some(MappingTarget::MapToUnknown) => line_syntax.ok_or_else(|| {
|
||||
@@ -332,6 +346,7 @@ mod tests {
|
||||
.clone()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn syntax_for_file_os(&self, file_name: &OsStr) -> String {
|
||||
self.syntax_for_file_with_content_os(file_name, "")
|
||||
}
|
||||
@@ -427,8 +442,8 @@ mod tests {
|
||||
|
||||
assert_eq!(test.syntax_for_file("test.h"), "C++");
|
||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||
assert_eq!(test.syntax_for_file("test.hs"), "Haskell (improved)");
|
||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+18
-10
@@ -13,6 +13,7 @@ use clap::ArgMatches;
|
||||
|
||||
use console::Term;
|
||||
|
||||
use crate::input::{new_file_input, new_stdin_input};
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
config::{Config, VisibleLines},
|
||||
@@ -84,6 +85,8 @@ impl App {
|
||||
if self.matches.occurrences_of("plain") > 1 {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
PagingMode::Never
|
||||
} else if self.matches.is_present("no-paging") {
|
||||
PagingMode::Never
|
||||
} 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
|
||||
@@ -162,16 +165,20 @@ impl App {
|
||||
// There's no point in wrapping when this is the case.
|
||||
WrappingMode::NoWrapping
|
||||
},
|
||||
colored_output: match self.matches.value_of("color") {
|
||||
Some("always") => true,
|
||||
Some("never") => false,
|
||||
Some("auto") | _ => self.interactive_output,
|
||||
},
|
||||
colored_output: self.matches.is_present("force-colorization")
|
||||
|| match self.matches.value_of("color") {
|
||||
Some("always") => true,
|
||||
Some("never") => false,
|
||||
Some("auto") | _ => {
|
||||
env::var_os("NO_COLOR").is_none() && self.interactive_output
|
||||
}
|
||||
},
|
||||
paging_mode,
|
||||
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
||||
loop_through: !(self.interactive_output
|
||||
|| self.matches.value_of("color") == Some("always")
|
||||
|| self.matches.value_of("decorations") == Some("always")),
|
||||
|| self.matches.value_of("decorations") == Some("always")
|
||||
|| self.matches.is_present("force-colorization")),
|
||||
tab_width: self
|
||||
.matches
|
||||
.value_of("tabs")
|
||||
@@ -257,8 +264,9 @@ impl App {
|
||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||
|
||||
if files.is_none() {
|
||||
let input = Input::stdin().with_name(filenames_or_none.next().unwrap_or(None));
|
||||
return Ok(vec![input]);
|
||||
return Ok(vec![new_stdin_input(
|
||||
filenames_or_none.next().unwrap_or(None),
|
||||
)]);
|
||||
}
|
||||
let files_or_none: Box<dyn Iterator<Item = _>> = match files {
|
||||
Some(ref files) => Box::new(files.iter().map(|name| Some(*name))),
|
||||
@@ -269,9 +277,9 @@ impl App {
|
||||
for (filepath, provided_name) in files_or_none.zip(filenames_or_none) {
|
||||
if let Some(filepath) = filepath {
|
||||
if filepath.to_str().unwrap_or_default() == "-" {
|
||||
file_input.push(Input::stdin().with_name(provided_name));
|
||||
file_input.push(new_stdin_input(provided_name));
|
||||
} else {
|
||||
file_input.push(Input::ordinary_file(filepath).with_name(provided_name));
|
||||
file_input.push(new_file_input(filepath, provided_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+49
-19
@@ -1,8 +1,9 @@
|
||||
use clap::{crate_name, crate_version, App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
let clap_color_setting = if interactive_output {
|
||||
let clap_color_setting = if interactive_output && env::var_os("NO_COLOR").is_none() {
|
||||
AppSettings::ColoredHelp
|
||||
} else {
|
||||
AppSettings::ColorNever
|
||||
@@ -103,8 +104,9 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.help("Specify the name to display for a file.")
|
||||
.long_help(
|
||||
"Specify the name to display for a file. Useful when piping \
|
||||
data to bat from STDIN when bat does not otherwise know \
|
||||
the filename.",
|
||||
data to bat from STDIN when bat does not otherwise know \
|
||||
the filename. Note that the provided file name is also \
|
||||
used for syntax detection.",
|
||||
),
|
||||
);
|
||||
|
||||
@@ -224,7 +226,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.help("When to use colors (*auto*, never, always).")
|
||||
.long_help(
|
||||
"Specify when to use colored output. The automatic mode \
|
||||
only enables colors if an interactive terminal is detected. \
|
||||
only enables colors if an interactive terminal is detected - \
|
||||
colors are automatically disabled if the output goes to a pipe.\n\
|
||||
Possible values: *auto*, never, always.",
|
||||
),
|
||||
)
|
||||
@@ -255,6 +258,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
an interactive terminal is detected. Possible values: *auto*, never, always.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("force-colorization")
|
||||
.long("force-colorization")
|
||||
.short("f")
|
||||
.conflicts_with("color")
|
||||
.conflicts_with("decorations")
|
||||
.overrides_with("force-colorization")
|
||||
.hidden_short_help(true)
|
||||
.long_help("Alias for '--decorations=always --color=always'. This is useful \
|
||||
if the output of bat is piped to another program, but you want \
|
||||
to keep the colorization/decorations.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("paging")
|
||||
.long("paging")
|
||||
@@ -264,16 +279,23 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.possible_values(&["auto", "never", "always"])
|
||||
.default_value("auto")
|
||||
.hide_default_value(true)
|
||||
.help("Specify when to use the pager (*auto*, never, always).")
|
||||
.help("Specify when to use the pager, or use `-P` to disable (*auto*, never, always).")
|
||||
.long_help(
|
||||
"Specify when to use the pager. To control which pager \
|
||||
is used, set the PAGER or BAT_PAGER environment \
|
||||
variables (the latter takes precedence) or use the '--pager' option. \
|
||||
To disable the pager permanently, set BAT_PAGER to an empty string \
|
||||
or set '--paging=never' in the configuration file. \
|
||||
Possible values: *auto*, never, always.",
|
||||
"Specify when to use the pager. To disable the pager, use \
|
||||
--paging=never' or its alias,'-P'. To disable the pager permanently, \
|
||||
set BAT_PAGER to an empty string. To control which pager is used, see the \
|
||||
'--pager' option. Possible values: *auto*, never, always."
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("no-paging")
|
||||
.short("P")
|
||||
.alias("no-pager")
|
||||
.overrides_with("no-paging")
|
||||
.hidden(true)
|
||||
.hidden_short_help(true)
|
||||
.help("Alias for '--paging=never'")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("pager")
|
||||
.long("pager")
|
||||
@@ -283,11 +305,10 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.hidden_short_help(true)
|
||||
.help("Determine which pager to use.")
|
||||
.long_help(
|
||||
"Determine which pager is used. This option will overwrite \
|
||||
the PAGER and BAT_PAGER environment variables. The default \
|
||||
pager is 'less'. To disable the pager completely, use the \
|
||||
'--paging' option. \
|
||||
Example: '--pager \"less -RF\"'.",
|
||||
"Determine which pager is used. This option will override the \
|
||||
PAGER and BAT_PAGER environment variables. The default pager is 'less'. \
|
||||
To control when the pager is used, see the '--paging' option. \
|
||||
Example: '--pager \"less -RF\"'."
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
@@ -338,7 +359,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.overrides_with("style")
|
||||
.overrides_with("plain")
|
||||
.overrides_with("number")
|
||||
// Cannot use clap's built in validation because we have to turn off clap's delimiters
|
||||
// Cannot use claps built in validation because we have to turn off clap's delimiters
|
||||
.validator(|val| {
|
||||
let mut invalid_vals = val.split(',').filter(|style| {
|
||||
!&[
|
||||
@@ -366,8 +387,17 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
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=\"..\"). \
|
||||
Possible values: *auto*, full, plain, changes, header, grid, numbers, snip.",
|
||||
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
|
||||
Possible values:\n\n \
|
||||
* full: enables all available components.\n \
|
||||
* auto: same as 'full', unless the output is piped (default).\n \
|
||||
* plain: disables all available components.\n \
|
||||
* changes: show Git modification markers.\n \
|
||||
* header: show filenames before the content.\n \
|
||||
* grid: vertical/horizontal lines to separate side bar\n \
|
||||
and the header from the content.\n \
|
||||
* numbers: show line numbers in the side bar.\n \
|
||||
* snip: draw separation lines between distinct line ranges.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
|
||||
@@ -63,7 +63,7 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
||||
# Uncomment the following line if you are using less version >= 551 and want to
|
||||
# enable mouse scrolling support in `bat` when running inside tmux. This might
|
||||
# disable text selection, unless you press shift.
|
||||
#--pager="--RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
||||
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
||||
|
||||
# Syntax mappings: map a certain filename pattern to a language.
|
||||
# Example 1: use the C++ syntax for .ino files
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
use bat::input::Input;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
|
||||
named(Input::ordinary_file(file), name.or_else(|| Some(file)))
|
||||
}
|
||||
|
||||
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
||||
named(Input::stdin(), name)
|
||||
}
|
||||
|
||||
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
||||
if let Some(provided_name) = name {
|
||||
let mut input = input.with_name(Some(provided_name));
|
||||
input.description_mut().set_kind(Some("File".to_owned()));
|
||||
input
|
||||
} else {
|
||||
input
|
||||
}
|
||||
}
|
||||
+62
-3
@@ -6,11 +6,12 @@ mod assets;
|
||||
mod clap_app;
|
||||
mod config;
|
||||
mod directories;
|
||||
mod input;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::path::Path;
|
||||
use std::process;
|
||||
|
||||
@@ -21,9 +22,11 @@ use crate::{
|
||||
app::App,
|
||||
config::{config_file, generate_config_file},
|
||||
};
|
||||
|
||||
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
|
||||
use clap::crate_version;
|
||||
use directories::PROJECT_DIRS;
|
||||
use globset::GlobMatcher;
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
@@ -32,8 +35,11 @@ use bat::{
|
||||
error::*,
|
||||
input::Input,
|
||||
style::{StyleComponent, StyleComponents},
|
||||
MappingTarget,
|
||||
};
|
||||
|
||||
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
|
||||
|
||||
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||
if matches.is_present("build") {
|
||||
let source_dir = matches
|
||||
@@ -56,15 +62,63 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_syntax_mapping_to_paths<'a>(
|
||||
mappings: &[(GlobMatcher, MappingTarget<'a>)],
|
||||
) -> HashMap<&'a str, Vec<String>> {
|
||||
let mut map = HashMap::new();
|
||||
for mapping in mappings {
|
||||
match mapping {
|
||||
(_, MappingTarget::MapToUnknown) => {}
|
||||
(matcher, MappingTarget::MapTo(s)) => {
|
||||
let globs = map.entry(*s).or_insert_with(Vec::new);
|
||||
globs.push(matcher.glob().glob().into());
|
||||
}
|
||||
}
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
pub fn list_languages(config: &Config) -> Result<()> {
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let mut languages = assets
|
||||
.syntaxes()
|
||||
.iter()
|
||||
.filter(|syntax| !syntax.hidden && !syntax.file_extensions.is_empty())
|
||||
.cloned()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
// Handling of file-extension conflicts, see issue #1076
|
||||
for lang in languages.iter_mut() {
|
||||
let lang_name = lang.name.clone();
|
||||
lang.file_extensions.retain(|extension| {
|
||||
// The 'extension' variable is not certainly a real extension.
|
||||
//
|
||||
// Skip if 'extension' starts with '.', likely a hidden file like '.vimrc'
|
||||
// Also skip if the 'extension' contains another real extension, likely
|
||||
// that is a full match file name like 'CMakeLists.txt' and 'Cargo.lock'
|
||||
if extension.starts_with('.') || Path::new(extension).extension().is_some() {
|
||||
true
|
||||
} else {
|
||||
let test_file = Path::new("test").with_extension(extension);
|
||||
match assets.syntax_for_file_name(test_file, &config.syntax_mapping) {
|
||||
Some(syntax) => syntax.name == lang_name,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
languages.sort_by_key(|lang| lang.name.to_uppercase());
|
||||
|
||||
let configured_languages = get_syntax_mapping_to_paths(config.syntax_mapping.mappings());
|
||||
|
||||
for lang in languages.iter_mut() {
|
||||
if let Some(additional_paths) = configured_languages.get(lang.name.as_str()) {
|
||||
lang.file_extensions
|
||||
.extend(additional_paths.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
@@ -118,11 +172,16 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn theme_preview_file<'a>() -> Input<'a> {
|
||||
Input::from_reader(Box::new(BufReader::new(THEME_PREVIEW_DATA)))
|
||||
}
|
||||
|
||||
pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let mut config = cfg.clone();
|
||||
let mut style = HashSet::new();
|
||||
style.insert(StyleComponent::Plain);
|
||||
config.language = Some("Rust");
|
||||
config.style_components = StyleComponents(style);
|
||||
|
||||
let stdout = io::stdout();
|
||||
@@ -137,7 +196,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
)?;
|
||||
config.theme = theme.to_string();
|
||||
Controller::new(&config, &assets)
|
||||
.run(vec![Input::theme_preview_file()])
|
||||
.run(vec![theme_preview_file()])
|
||||
.ok();
|
||||
writeln!(stdout)?;
|
||||
}
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ impl<'b> Controller<'b> {
|
||||
};
|
||||
|
||||
let mut printer: Box<dyn Printer> = if self.config.loop_through {
|
||||
Box::new(SimplePrinter::new())
|
||||
Box::new(SimplePrinter::new(&self.config))
|
||||
} else {
|
||||
Box::new(InteractivePrinter::new(
|
||||
&self.config,
|
||||
|
||||
+95
-67
@@ -6,22 +6,82 @@ use content_inspector::{self, ContentType};
|
||||
|
||||
use crate::error::*;
|
||||
|
||||
const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
|
||||
/// A description of an Input source.
|
||||
/// This tells bat how to refer to the input.
|
||||
#[derive(Clone)]
|
||||
pub struct InputDescription {
|
||||
pub(crate) name: String,
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct InputDescription {
|
||||
pub full: String,
|
||||
pub prefix: String,
|
||||
pub name: String,
|
||||
/// The input title.
|
||||
/// This replaces the name if provided.
|
||||
title: Option<String>,
|
||||
|
||||
/// The input kind.
|
||||
kind: Option<String>,
|
||||
|
||||
/// A summary description of the input.
|
||||
/// Defaults to "{kind} '{name}'"
|
||||
summary: Option<String>,
|
||||
}
|
||||
|
||||
impl InputDescription {
|
||||
/// Creates a description for an input.
|
||||
pub fn new(name: impl Into<String>) -> Self {
|
||||
InputDescription {
|
||||
name: name.into(),
|
||||
title: None,
|
||||
kind: None,
|
||||
summary: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_kind(&mut self, kind: Option<String>) {
|
||||
self.kind = kind;
|
||||
}
|
||||
|
||||
pub fn set_summary(&mut self, summary: Option<String>) {
|
||||
self.summary = summary;
|
||||
}
|
||||
|
||||
pub fn set_title(&mut self, title: Option<String>) {
|
||||
self.title = title;
|
||||
}
|
||||
|
||||
pub fn title(&self) -> &String {
|
||||
match self.title.as_ref() {
|
||||
Some(ref title) => title,
|
||||
None => &self.name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> Option<&String> {
|
||||
self.kind.as_ref()
|
||||
}
|
||||
|
||||
pub fn summary(&self) -> String {
|
||||
self.summary.clone().unwrap_or_else(|| match &self.kind {
|
||||
None => self.name.clone(),
|
||||
Some(kind) => format!("{} '{}'", kind.to_lowercase(), self.name),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(OsString),
|
||||
StdIn,
|
||||
ThemePreviewFile,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
}
|
||||
|
||||
impl<'a> InputKind<'a> {
|
||||
pub fn description(&self) -> InputDescription {
|
||||
match self {
|
||||
InputKind::OrdinaryFile(ref path) => InputDescription::new(path.to_string_lossy()),
|
||||
InputKind::StdIn => InputDescription::new("STDIN"),
|
||||
InputKind::CustomReader(_) => InputDescription::new("READER"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub(crate) struct InputMetadata {
|
||||
pub(crate) user_provided_name: Option<OsString>,
|
||||
@@ -30,56 +90,47 @@ pub(crate) struct InputMetadata {
|
||||
pub struct Input<'a> {
|
||||
pub(crate) kind: InputKind<'a>,
|
||||
pub(crate) metadata: InputMetadata,
|
||||
pub(crate) description: InputDescription,
|
||||
}
|
||||
|
||||
pub(crate) enum OpenedInputKind {
|
||||
OrdinaryFile(OsString),
|
||||
StdIn,
|
||||
ThemePreviewFile,
|
||||
CustomReader,
|
||||
}
|
||||
|
||||
impl OpenedInputKind {
|
||||
pub(crate) fn is_theme_preview_file(&self) -> bool {
|
||||
match self {
|
||||
OpenedInputKind::ThemePreviewFile => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct OpenedInput<'a> {
|
||||
pub(crate) kind: OpenedInputKind,
|
||||
pub(crate) metadata: InputMetadata,
|
||||
pub(crate) reader: InputReader<'a>,
|
||||
pub(crate) description: InputDescription,
|
||||
}
|
||||
|
||||
impl<'a> Input<'a> {
|
||||
pub fn ordinary_file(path: &OsStr) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_os_string());
|
||||
Input {
|
||||
kind: InputKind::OrdinaryFile(path.to_os_string()),
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
kind,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stdin() -> Self {
|
||||
let kind = InputKind::StdIn;
|
||||
Input {
|
||||
kind: InputKind::StdIn,
|
||||
metadata: InputMetadata::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn theme_preview_file() -> Self {
|
||||
Input {
|
||||
kind: InputKind::ThemePreviewFile,
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
kind,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_reader(reader: Box<dyn Read + 'a>) -> Self {
|
||||
let kind = InputKind::CustomReader(reader);
|
||||
Input {
|
||||
kind: InputKind::CustomReader(reader),
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
kind,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,19 +143,35 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
|
||||
pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
|
||||
match provided_name {
|
||||
Some(name) => self.description.name = name.to_string_lossy().to_string(),
|
||||
None => {}
|
||||
}
|
||||
|
||||
self.metadata.user_provided_name = provided_name.map(|n| n.to_owned());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn description(&self) -> &InputDescription {
|
||||
&self.description
|
||||
}
|
||||
|
||||
pub fn description_mut(&mut self) -> &mut InputDescription {
|
||||
&mut self.description
|
||||
}
|
||||
|
||||
pub(crate) fn open<R: BufRead + 'a>(self, stdin: R) -> Result<OpenedInput<'a>> {
|
||||
let description = self.description().clone();
|
||||
match self.kind {
|
||||
InputKind::StdIn => Ok(OpenedInput {
|
||||
kind: OpenedInputKind::StdIn,
|
||||
description,
|
||||
metadata: self.metadata,
|
||||
reader: InputReader::new(stdin),
|
||||
}),
|
||||
InputKind::OrdinaryFile(path) => Ok(OpenedInput {
|
||||
kind: OpenedInputKind::OrdinaryFile(path.clone()),
|
||||
description,
|
||||
metadata: self.metadata,
|
||||
reader: {
|
||||
let file = File::open(&path)
|
||||
@@ -115,12 +182,8 @@ impl<'a> Input<'a> {
|
||||
InputReader::new(BufReader::new(file))
|
||||
},
|
||||
}),
|
||||
InputKind::ThemePreviewFile => Ok(OpenedInput {
|
||||
kind: OpenedInputKind::ThemePreviewFile,
|
||||
metadata: self.metadata,
|
||||
reader: InputReader::new(THEME_PREVIEW_FILE),
|
||||
}),
|
||||
InputKind::CustomReader(reader) => Ok(OpenedInput {
|
||||
description,
|
||||
kind: OpenedInputKind::CustomReader,
|
||||
metadata: self.metadata,
|
||||
reader: InputReader::new(BufReader::new(reader)),
|
||||
@@ -129,41 +192,6 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> OpenedInput<'a> {
|
||||
pub fn description(&self) -> InputDescription {
|
||||
if let Some(ref name) = self.metadata.user_provided_name {
|
||||
InputDescription {
|
||||
full: format!("file '{}'", name.to_string_lossy()),
|
||||
prefix: "File: ".to_owned(),
|
||||
name: name.to_string_lossy().into_owned(),
|
||||
}
|
||||
} else {
|
||||
match self.kind {
|
||||
OpenedInputKind::OrdinaryFile(ref path) => InputDescription {
|
||||
full: format!("file '{}'", path.to_string_lossy()),
|
||||
prefix: "File: ".to_owned(),
|
||||
name: path.to_string_lossy().into_owned(),
|
||||
},
|
||||
OpenedInputKind::StdIn => InputDescription {
|
||||
full: "STDIN".to_owned(),
|
||||
prefix: "".to_owned(),
|
||||
name: "STDIN".to_owned(),
|
||||
},
|
||||
OpenedInputKind::ThemePreviewFile => InputDescription {
|
||||
full: "".to_owned(),
|
||||
prefix: "".to_owned(),
|
||||
name: "".to_owned(),
|
||||
},
|
||||
OpenedInputKind::CustomReader => InputDescription {
|
||||
full: "reader".to_owned(),
|
||||
prefix: "".to_owned(),
|
||||
name: "READER".into(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct InputReader<'a> {
|
||||
inner: Box<dyn BufRead + 'a>,
|
||||
pub(crate) first_line: Vec<u8>,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ pub(crate) mod syntax_mapping;
|
||||
mod terminal;
|
||||
pub(crate) mod wrapping;
|
||||
|
||||
pub use pretty_printer::PrettyPrinter;
|
||||
pub use pretty_printer::{Input, PrettyPrinter};
|
||||
pub use syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||
pub use wrapping::WrappingMode;
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
||||
|
||||
match chr {
|
||||
// space
|
||||
' ' => output.push('•'),
|
||||
' ' => output.push('·'),
|
||||
// tab
|
||||
'\t' => {
|
||||
if tab_width == 1 {
|
||||
|
||||
+90
-12
@@ -9,7 +9,7 @@ use crate::{
|
||||
config::{Config, VisibleLines},
|
||||
controller::Controller,
|
||||
error::Result,
|
||||
input::Input,
|
||||
input,
|
||||
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||
style::{StyleComponent, StyleComponents},
|
||||
SyntaxMapping, WrappingMode,
|
||||
@@ -55,10 +55,23 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add an input which should be pretty-printed
|
||||
pub fn input(&mut self, input: Input<'a>) -> &mut Self {
|
||||
self.inputs.push(input);
|
||||
self
|
||||
}
|
||||
|
||||
/// Adds multiple inputs which should be pretty-printed
|
||||
pub fn inputs(&mut self, inputs: impl IntoIterator<Item = Input<'a>>) -> &mut Self {
|
||||
for input in inputs {
|
||||
self.inputs.push(input);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
/// Add a file which should be pretty-printed
|
||||
pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
|
||||
self.inputs.push(Input::ordinary_file(path.as_ref()));
|
||||
self
|
||||
self.input(Input::from_file(path).kind("File"))
|
||||
}
|
||||
|
||||
/// Add multiple files which should be pretty-printed
|
||||
@@ -67,22 +80,20 @@ impl<'a> PrettyPrinter<'a> {
|
||||
I: IntoIterator<Item = P>,
|
||||
P: AsRef<OsStr>,
|
||||
{
|
||||
for path in paths {
|
||||
self.inputs.push(Input::ordinary_file(path.as_ref()));
|
||||
}
|
||||
self
|
||||
self.inputs(paths.into_iter().map(Input::from_file))
|
||||
}
|
||||
|
||||
/// Add STDIN as an input
|
||||
pub fn input_stdin(&mut self) -> &mut Self {
|
||||
self.inputs.push(Input::stdin());
|
||||
self.inputs.push(Input::from_stdin());
|
||||
self
|
||||
}
|
||||
|
||||
/// Add STDIN as an input (with customized name)
|
||||
#[deprecated]
|
||||
pub fn input_stdin_with_name(&mut self, name: impl AsRef<OsStr>) -> &mut Self {
|
||||
self.inputs
|
||||
.push(Input::stdin().with_name(Some(name.as_ref())));
|
||||
.push(Input::from_stdin().name(name).kind("File"));
|
||||
self
|
||||
}
|
||||
|
||||
@@ -92,6 +103,8 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
|
||||
/// Add a byte string as an input (with customized name)
|
||||
#[deprecated]
|
||||
#[allow(deprecated)]
|
||||
pub fn input_from_bytes_with_name(
|
||||
&mut self,
|
||||
content: &'a [u8],
|
||||
@@ -102,18 +115,19 @@ impl<'a> PrettyPrinter<'a> {
|
||||
|
||||
/// Add a custom reader as an input
|
||||
pub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self {
|
||||
self.inputs.push(Input::from_reader(Box::new(reader)));
|
||||
self.inputs.push(Input::from_reader(reader));
|
||||
self
|
||||
}
|
||||
|
||||
/// Add a custom reader as an input (with customized name)
|
||||
#[deprecated]
|
||||
pub fn input_from_reader_with_name<R: Read + 'a>(
|
||||
&mut self,
|
||||
reader: R,
|
||||
name: impl AsRef<OsStr>,
|
||||
) -> &mut Self {
|
||||
self.inputs
|
||||
.push(Input::from_reader(Box::new(reader)).with_name(Some(name.as_ref())));
|
||||
.push(Input::from_reader(reader).name(name).kind("File"));
|
||||
self
|
||||
}
|
||||
|
||||
@@ -286,10 +300,74 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
self.config.style_components = StyleComponents::new(&style_components);
|
||||
|
||||
// Collect the inputs to print
|
||||
let mut inputs: Vec<Input> = vec![];
|
||||
std::mem::swap(&mut inputs, &mut self.inputs);
|
||||
|
||||
// Run the controller
|
||||
let controller = Controller::new(&self.config, &self.assets);
|
||||
controller.run(inputs)
|
||||
controller.run(inputs.into_iter().map(|i| i.into()).collect())
|
||||
}
|
||||
}
|
||||
|
||||
/// An input source for the pretty printer.
|
||||
pub struct Input<'a> {
|
||||
input: input::Input<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Input<'a> {
|
||||
/// A new input from a reader.
|
||||
pub fn from_reader<R: Read + 'a>(reader: R) -> Self {
|
||||
input::Input::from_reader(Box::new(reader)).into()
|
||||
}
|
||||
|
||||
/// A new input from a file.
|
||||
pub fn from_file(path: impl AsRef<OsStr>) -> Self {
|
||||
input::Input::ordinary_file(path.as_ref()).into()
|
||||
}
|
||||
|
||||
/// A new input from bytes.
|
||||
pub fn from_bytes(bytes: &'a [u8]) -> Self {
|
||||
Input::from_reader(bytes).into()
|
||||
}
|
||||
|
||||
/// A new input from STDIN.
|
||||
pub fn from_stdin() -> Self {
|
||||
input::Input::stdin().into()
|
||||
}
|
||||
|
||||
/// The filename of the input.
|
||||
/// This affects syntax detection and changes the default header title.
|
||||
pub fn name(mut self, name: impl AsRef<OsStr>) -> Self {
|
||||
self.input = self.input.with_name(Some(name.as_ref()));
|
||||
self
|
||||
}
|
||||
|
||||
/// The description for the type of input (e.g. "File")
|
||||
pub fn kind(mut self, kind: impl Into<String>) -> Self {
|
||||
let kind = kind.into();
|
||||
self.input
|
||||
.description_mut()
|
||||
.set_kind(if kind.is_empty() { None } else { Some(kind) });
|
||||
self
|
||||
}
|
||||
|
||||
/// The title for the input (e.g. "http://example.com/example.txt")
|
||||
/// This defaults to the file name.
|
||||
pub fn title(mut self, title: impl Into<String>) -> Self {
|
||||
self.input.description_mut().set_title(Some(title.into()));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<Input<'a>> for input::Input<'a> {
|
||||
fn into(self) -> Input<'a> {
|
||||
Input { input: self }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<input::Input<'a>> for Input<'a> {
|
||||
fn into(self) -> input::Input<'a> {
|
||||
self.input
|
||||
}
|
||||
}
|
||||
|
||||
+23
-10
@@ -52,15 +52,17 @@ pub(crate) trait Printer {
|
||||
) -> Result<()>;
|
||||
}
|
||||
|
||||
pub struct SimplePrinter;
|
||||
pub struct SimplePrinter<'a> {
|
||||
config: &'a Config<'a>,
|
||||
}
|
||||
|
||||
impl SimplePrinter {
|
||||
pub fn new() -> Self {
|
||||
SimplePrinter {}
|
||||
impl<'a> SimplePrinter<'a> {
|
||||
pub fn new(config: &'a Config) -> Self {
|
||||
SimplePrinter { config }
|
||||
}
|
||||
}
|
||||
|
||||
impl Printer for SimplePrinter {
|
||||
impl<'a> Printer for SimplePrinter<'a> {
|
||||
fn print_header(
|
||||
&mut self,
|
||||
_handle: &mut dyn Write,
|
||||
@@ -86,7 +88,15 @@ impl Printer for SimplePrinter {
|
||||
line_buffer: &[u8],
|
||||
) -> Result<()> {
|
||||
if !out_of_range {
|
||||
handle.write_all(line_buffer)?;
|
||||
if self.config.show_nonprintable {
|
||||
let line = replace_nonprintable(line_buffer, self.config.tab_width);
|
||||
write!(handle, "{}", line)?;
|
||||
if line_buffer.last() == Some(&b'\n') {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
} else {
|
||||
handle.write_all(line_buffer)?
|
||||
};
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -249,7 +259,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
(but will be present if the output of 'bat' is piped). You can use 'bat -A' \
|
||||
to show the binary file contents.",
|
||||
Yellow.paint("[bat warning]"),
|
||||
input.description().full,
|
||||
input.description.summary(),
|
||||
)?;
|
||||
} else if self.config.style_components.grid() {
|
||||
self.print_horizontal_line(handle, '┬')?;
|
||||
@@ -283,13 +293,16 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
_ => "",
|
||||
};
|
||||
|
||||
let description = input.description();
|
||||
let description = &input.description;
|
||||
|
||||
writeln!(
|
||||
handle,
|
||||
"{}{}{}",
|
||||
description.prefix,
|
||||
self.colors.filename.paint(&description.name),
|
||||
description
|
||||
.kind()
|
||||
.map(|kind| format!("{}: ", kind))
|
||||
.unwrap_or("".into()),
|
||||
self.colors.filename.paint(description.title()),
|
||||
mode
|
||||
)?;
|
||||
|
||||
|
||||
+87
-2
@@ -23,6 +23,7 @@ impl<'a> SyntaxMapping<'a> {
|
||||
pub fn builtin() -> SyntaxMapping<'a> {
|
||||
let mut mapping = Self::empty();
|
||||
mapping.insert("*.h", MappingTarget::MapTo("C++")).unwrap();
|
||||
mapping.insert("*.fs", MappingTarget::MapTo("F#")).unwrap();
|
||||
mapping
|
||||
.insert("build", MappingTarget::MapToUnknown)
|
||||
.unwrap();
|
||||
@@ -47,6 +48,86 @@ impl<'a> SyntaxMapping<'a> {
|
||||
.insert("rails", MappingTarget::MapToUnknown)
|
||||
.unwrap();
|
||||
|
||||
// Nginx and Apache syntax files both want to style all ".conf" files
|
||||
// see #1131 and #1137
|
||||
mapping
|
||||
.insert("*.conf", MappingTarget::MapToUnknown)
|
||||
.unwrap();
|
||||
|
||||
for glob in &[
|
||||
"/etc/nginx/**/*.conf",
|
||||
"/etc/nginx/sites-*/**/*",
|
||||
"nginx.conf",
|
||||
"mime.types",
|
||||
] {
|
||||
mapping.insert(glob, MappingTarget::MapTo("nginx")).unwrap();
|
||||
}
|
||||
|
||||
for glob in &[
|
||||
"/etc/apache2/**/*.conf",
|
||||
"/etc/apache2/sites-*/**/*",
|
||||
"httpd.conf",
|
||||
] {
|
||||
mapping
|
||||
.insert(glob, MappingTarget::MapTo("Apache Conf"))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
for glob in [
|
||||
"**/systemd/**/*.conf",
|
||||
"**/systemd/**/*.example",
|
||||
"*.automount",
|
||||
"*.device",
|
||||
"*.dnssd",
|
||||
"*.link",
|
||||
"*.mount",
|
||||
"*.netdev",
|
||||
"*.network",
|
||||
"*.nspawn",
|
||||
"*.path",
|
||||
"*.service",
|
||||
"*.scope",
|
||||
"*.slice",
|
||||
"*.socket",
|
||||
"*.swap",
|
||||
"*.target",
|
||||
"*.timer",
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
mapping.insert(glob, MappingTarget::MapTo("INI")).unwrap();
|
||||
}
|
||||
|
||||
// pacman hooks
|
||||
mapping
|
||||
.insert("*.hook", MappingTarget::MapTo("INI"))
|
||||
.unwrap();
|
||||
|
||||
if let Some(xdg_config_home) = std::env::var_os("XDG_CONFIG_HOME") {
|
||||
let git_config_path = Path::new(&xdg_config_home).join("git");
|
||||
|
||||
mapping
|
||||
.insert(
|
||||
&git_config_path.join("config").to_string_lossy(),
|
||||
MappingTarget::MapTo("Git Config"),
|
||||
)
|
||||
.ok();
|
||||
|
||||
mapping
|
||||
.insert(
|
||||
&git_config_path.join("ignore").to_string_lossy(),
|
||||
MappingTarget::MapTo("Git Ignore"),
|
||||
)
|
||||
.ok();
|
||||
|
||||
mapping
|
||||
.insert(
|
||||
&git_config_path.join("attributes").to_string_lossy(),
|
||||
MappingTarget::MapTo("Git Attributes"),
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
|
||||
mapping
|
||||
}
|
||||
|
||||
@@ -59,12 +140,16 @@ impl<'a> SyntaxMapping<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn mappings(&self) -> &[(GlobMatcher, MappingTarget<'a>)] {
|
||||
&self.mappings
|
||||
}
|
||||
|
||||
pub(crate) fn get_syntax_for(&self, path: impl AsRef<Path>) -> Option<MappingTarget<'a>> {
|
||||
let candidate = Candidate::new(path.as_ref());
|
||||
let canddidate_filename = path.as_ref().file_name().map(Candidate::new);
|
||||
let candidate_filename = path.as_ref().file_name().map(Candidate::new);
|
||||
for (ref glob, ref syntax) in self.mappings.iter().rev() {
|
||||
if glob.is_match_candidate(&candidate)
|
||||
|| canddidate_filename
|
||||
|| candidate_filename
|
||||
.as_ref()
|
||||
.map_or(false, |filename| glob.is_match_candidate(filename))
|
||||
{
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term:
|
||||
// Themes can specify one of the user-configurable terminal colors by
|
||||
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
|
||||
// to the 8-bit color palette number. The built-in themes ansi-light,
|
||||
// ansi-dark, and base16 use this.
|
||||
// ansi-dark, base16, and base16-256 use this.
|
||||
match color.r {
|
||||
// For the first 8 colors, use the Color enum to produce ANSI escape
|
||||
// sequences using codes 30-37 (foreground) and 40-47 (background).
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
# force LF EOLs for test fixtures
|
||||
examples/** text=auto eol=lf
|
||||
snapshots/** text=auto eol=lf
|
||||
|
||||
# BAT/CMD files always need CRLF EOLs
|
||||
*.[Bb][Aa][Tt] text eol=crlf
|
||||
*.[Cc][Mm][Dd] text eol=crlf
|
||||
|
||||
examples/* linguist-vendored
|
||||
snapshots/* linguist-vendored
|
||||
benchmarks/* linguist-vendored
|
||||
benchmarks/test-src/* linguist-vendored
|
||||
scripts/* linguist-vendored
|
||||
syntax-tests/* linguist-vendored
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
use bat::assets::HighlightingAssets;
|
||||
|
||||
/// This test ensures that we are not accidentally removing themes due to submodule updates.
|
||||
#[test]
|
||||
fn all_themes_are_present() {
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
let mut themes: Vec<_> = assets.themes().collect();
|
||||
themes.sort();
|
||||
|
||||
assert_eq!(
|
||||
themes,
|
||||
vec![
|
||||
"1337",
|
||||
"DarkNeon",
|
||||
"Dracula",
|
||||
"GitHub",
|
||||
"Monokai Extended",
|
||||
"Monokai Extended Bright",
|
||||
"Monokai Extended Light",
|
||||
"Monokai Extended Origin",
|
||||
"Nord",
|
||||
"OneHalfDark",
|
||||
"OneHalfLight",
|
||||
"Solarized (dark)",
|
||||
"Solarized (light)",
|
||||
"Sublime Snazzy",
|
||||
"TwoDark",
|
||||
"ansi-dark",
|
||||
"ansi-light",
|
||||
"base16",
|
||||
"base16-256",
|
||||
"gruvbox",
|
||||
"gruvbox-light",
|
||||
"gruvbox-white",
|
||||
"zenburn"
|
||||
]
|
||||
);
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
use assert_cmd::Command;
|
||||
use predicates::{prelude::predicate, str::PredicateStrExt};
|
||||
use std::path::Path;
|
||||
use std::str::from_utf8;
|
||||
|
||||
@@ -377,7 +378,7 @@ fn pager_basic() {
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("pager-output\n");
|
||||
.stdout(predicate::eq("pager-output\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -389,7 +390,7 @@ fn pager_overwrite() {
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("pager-output\n");
|
||||
.stdout(predicate::eq("pager-output\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -401,7 +402,30 @@ fn pager_disable() {
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("hello world\n");
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_pager_disable() {
|
||||
bat()
|
||||
.env("PAGER", "echo other-pager")
|
||||
.arg("-P")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alias_pager_disable_long_overrides_short() {
|
||||
bat()
|
||||
.env("PAGER", "echo pager-output")
|
||||
.arg("-P")
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("pager-output\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -421,7 +445,7 @@ fn config_read_arguments_from_file() {
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("dummy-pager-from-config\n");
|
||||
.stdout(predicate::eq("dummy-pager-from-config\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -715,3 +739,13 @@ fn do_not_detect_different_syntax_for_stdin_and_files() {
|
||||
from_utf8(&cmd_for_stdin.get_output().stdout).expect("output is valid utf-8")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn show_all_mode() {
|
||||
bat()
|
||||
.arg("--show-all")
|
||||
.arg("nonprintable.txt")
|
||||
.assert()
|
||||
.stdout("hello·world␊\n├──┤␍␀␇␈␛")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@ fn no_duplicate_extensions() {
|
||||
// The '.h' extension currently appears in multiple syntaxes: C, C++, Objective C,
|
||||
// Objective C++
|
||||
"h",
|
||||
// In addition to the standard Haskell syntax in 'Packages', we also ship the 'Cabal'
|
||||
// syntax which comes with a "Haskell (improved)" syntax.
|
||||
"hs",
|
||||
// In addition to the standard JavaScript syntax in 'Packages', we also ship the
|
||||
// 'Javascript (Babel)' syntax.
|
||||
"js",
|
||||
// The "Ruby Haml" syntax also comes with a '.sass' extension. However, we make sure
|
||||
// that 'sass' is mapped to the 'Sass' syntax.
|
||||
"sass",
|
||||
// The '.fs' extension appears in F# and GLSL.
|
||||
// We default to F#.
|
||||
"fs",
|
||||
];
|
||||
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import sys
|
||||
import os.path as path
|
||||
import difflib
|
||||
import argparse
|
||||
|
||||
|
||||
def compare_highlighted_versions(root_old, root_new):
|
||||
print("Comparing the following directories:")
|
||||
print(" -", root_old)
|
||||
print(" -", root_new)
|
||||
has_changes = False
|
||||
for path_old in glob.glob(path.join(root_old, "*", "*")):
|
||||
filename = path.basename(path_old)
|
||||
dirname = path.basename(path.dirname(path_old))
|
||||
|
||||
path_new = path.join(root_new, dirname, filename)
|
||||
|
||||
print("\n========== {}/{}".format(dirname, filename))
|
||||
|
||||
with open(path_old) as file_old:
|
||||
lines_old = file_old.readlines()
|
||||
|
||||
with open(path_new) as file_new:
|
||||
lines_new = file_new.readlines()
|
||||
|
||||
diff = difflib.unified_diff(
|
||||
lines_old, lines_new, fromfile=path_old, tofile=path_new
|
||||
)
|
||||
|
||||
file_has_changes = False
|
||||
for line in diff:
|
||||
print(line, end="")
|
||||
file_has_changes = True
|
||||
|
||||
if file_has_changes:
|
||||
has_changes = True
|
||||
else:
|
||||
print("No changes")
|
||||
print()
|
||||
|
||||
return has_changes
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="This script compares two directories that were created "
|
||||
"by 'create_highlighted_versions.py'."
|
||||
)
|
||||
parser.add_argument(
|
||||
"OLD", help="Path to the old (stored) version of the highlighted output",
|
||||
)
|
||||
parser.add_argument(
|
||||
"NEW", help="Path to the new version of the highlighted output",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if compare_highlighted_versions(args.OLD, args.NEW):
|
||||
print("Error: files with changes have been found")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("Directories are the same")
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
import glob
|
||||
import sys
|
||||
import os.path as path
|
||||
import os
|
||||
import argparse
|
||||
|
||||
|
||||
BAT_OPTIONS = [
|
||||
"--no-config",
|
||||
"--style=plain",
|
||||
"--color=always",
|
||||
"--theme='1337'",
|
||||
"--italic-text=always",
|
||||
]
|
||||
|
||||
|
||||
def create_highlighted_versions(output_basepath):
|
||||
root = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
for source in glob.glob(path.join(root, "source", "*", "*")):
|
||||
try:
|
||||
env = os.environ.copy()
|
||||
env.pop("PAGER", None)
|
||||
env.pop("BAT_PAGER", None)
|
||||
env.pop("BAT_CONFIG_PATH", None)
|
||||
env.pop("BAT_STYLE", None)
|
||||
env.pop("BAT_THEME", None)
|
||||
env.pop("BAT_TABS", None)
|
||||
env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
|
||||
|
||||
bat_output = subprocess.check_output(
|
||||
["bat"] + BAT_OPTIONS + [source], stderr=subprocess.PIPE, env=env,
|
||||
)
|
||||
|
||||
source_dirname = path.basename(path.dirname(source))
|
||||
source_filename = path.basename(source)
|
||||
|
||||
if source_filename == "LICENSE.md":
|
||||
continue
|
||||
|
||||
output_dir = path.join(output_basepath, source_dirname)
|
||||
output_path = path.join(output_dir, source_filename)
|
||||
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
with open(output_path, "wb") as output_file:
|
||||
output_file.write(bat_output)
|
||||
|
||||
print("Created '{}'".format(output_path))
|
||||
except subprocess.CalledProcessError as err:
|
||||
print(
|
||||
"=== Error: Could not highlight source file '{}".format(source),
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"=== bat stdout:\n{}".format(err.stdout.decode("utf-8")),
|
||||
file=sys.stderr,
|
||||
)
|
||||
print(
|
||||
"=== bat stderr:\n{}".format(err.stderr.decode("utf-8")),
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="This script creates syntax-highlighted versions of all "
|
||||
"files in the 'source' directory."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--output",
|
||||
"-O",
|
||||
metavar="PATH",
|
||||
help="Output directory",
|
||||
required=True,
|
||||
type=str,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
create_highlighted_versions(output_basepath=args.output)
|
||||
@@ -0,0 +1,35 @@
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m quicksort.awk --- Quicksort algorithm, with user-supplied[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m comparison function[0m
|
||||
[38;2;117;113;94m#[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Arnold Robbins, arnold@skeeve.com, Public Domain[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m January 2009[0m
|
||||
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m or almost any algorithms or computer science text.[0m
|
||||
[38;2;117;113;94m#[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Adapted from K&R-II, page 110[0m
|
||||
|
||||
[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mquicksort[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mdata[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mleft[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mright[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mless_than[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mi[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mlast[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mleft[0m[38;2;248;248;242m [0m[38;2;249;38;114m>=[0m[38;2;248;248;242m [0m[38;2;255;255;255mright[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m do nothing if array contains fewer[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mreturn[0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m than two elements[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mquicksort_swap[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mleft[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;102;217;239mint[0m[38;2;255;255;255m([0m[38;2;255;255;255m([0m[38;2;255;255;255mleft[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mright[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m/[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mlast[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mleft[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mfor[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mleft[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m; [0m[38;2;255;255;255mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;255;255;255mright[0m[38;2;248;248;242m; [0m[38;2;255;255;255mi[0m[38;2;249;38;114m++[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;248;248;242m@[0m[38;2;166;226;46mless_than[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mleft[0m[38;2;249;38;114m][0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mquicksort_swap[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;249;38;114m+[0m[38;2;255;255;255mlast[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mi[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mquicksort_swap[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mleft[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mlast[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mquicksort[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mleft[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mlast[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mless_than[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mquicksort[0m[38;2;255;255;255m([0m[38;2;255;255;255mdata[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mlast[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mright[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;255;255;255mless_than[0m[38;2;255;255;255m)[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m quicksort_swap --- helper function for quicksort, should really be inline[0m
|
||||
|
||||
[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mquicksort_swap[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mdata[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mi[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mj[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mtemp[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mtemp[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mi[0m[38;2;249;38;114m][0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mi[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mj[0m[38;2;249;38;114m][0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mdata[0m[38;2;249;38;114m[[0m[38;2;255;255;255mj[0m[38;2;249;38;114m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mtemp[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
@@ -0,0 +1,16 @@
|
||||
[38;2;249;38;114mReturn-Path[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m<[0m[4;38;2;166;226;46muser@example.com[0m[38;2;248;248;242m>[0m
|
||||
[38;2;249;38;114mReceived[0m[38;2;248;248;242m:[0m[38;2;248;248;242m from mail.example [0m[38;2;117;113;94m([0m[38;2;117;113;94m[1.1.1.1][0m[38;2;117;113;94m)[0m
|
||||
[38;2;248;248;242m by mail.example with LMTP[0m
|
||||
[38;2;248;248;242m id 123[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m([0m[38;2;117;113;94menvelope-from <user@example.com>[0m[38;2;117;113;94m)[0m
|
||||
[38;2;248;248;242m for [0m[38;2;248;248;242m<[0m[4;38;2;166;226;46ma@b[0m[38;2;248;248;242m>[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;190;132;255mSun[0m[38;2;190;132;255m,[0m[38;2;190;132;255m 13[0m[38;2;190;132;255m Oct[0m[38;2;190;132;255m 2019[0m[38;2;190;132;255m 13[0m[38;2;190;132;255m:[0m[38;2;190;132;255m53[0m[38;2;190;132;255m:[0m[38;2;190;132;255m24[0m[38;2;190;132;255m [0m[38;2;249;38;114m+[0m[38;2;190;132;255m0000[0m
|
||||
[38;2;166;226;46mFrom[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mUser, Test[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;248;248;242m<[0m[4;38;2;166;226;46muser@example.com[0m[38;2;248;248;242m>[0m
|
||||
[38;2;166;226;46mTo[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mUser2, Test[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;248;248;242m<[0m[4;38;2;166;226;46muser2@example.com[0m[38;2;248;248;242m>[0m
|
||||
[38;2;166;226;46mSubject[0m[38;2;248;248;242m:[0m
|
||||
[38;2;166;226;46mDate[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255mSun[0m[38;2;190;132;255m,[0m[38;2;190;132;255m 13[0m[38;2;190;132;255m Oct[0m[38;2;190;132;255m 2019[0m[38;2;190;132;255m 13[0m[38;2;190;132;255m:[0m[38;2;190;132;255m53[0m[38;2;190;132;255m:[0m[38;2;190;132;255m08[0m[38;2;190;132;255m [0m[38;2;249;38;114m+[0m[38;2;190;132;255m0000[0m
|
||||
[38;2;249;38;114mAccept-Language[0m[38;2;248;248;242m:[0m[38;2;248;248;242m de-DE, en-US[0m
|
||||
[38;2;249;38;114mContent-Language[0m[38;2;248;248;242m:[0m[38;2;248;248;242m de-DE[0m
|
||||
[38;2;249;38;114mX-[0m[38;2;249;38;114mMS-Has-Attach[0m[38;2;248;248;242m:[0m[38;2;248;248;242m yes[0m
|
||||
[38;2;249;38;114mMIME-Version[0m[38;2;248;248;242m:[0m[38;2;248;248;242m 1.0[0m
|
||||
|
||||
[38;2;230;219;116mTest[0m
|
||||
@@ -0,0 +1,7 @@
|
||||
[38;2;117;113;94m# Static information about the filesystems.[0m
|
||||
[38;2;117;113;94m# See fstab(5) for details.[0m
|
||||
|
||||
[38;2;117;113;94m# <file system> <dir> <type> <options> <dump> <pass>[0m
|
||||
|
||||
[38;2;248;248;242mUUID=[0m[38;2;249;38;114m9e6faddf-31ab-3f3e-9b50-2ad4fbc2ea8b[0m[38;2;248;248;242m [0m[38;2;230;219;116m/ [0m[3;38;2;253;151;31mext4 [0m[38;2;166;226;46mrw[0m[38;2;248;248;242m,[0m[38;2;166;226;46mrelatime[0m[38;2;248;248;242m,[0m[38;2;166;226;46mdata[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31mordered[0m[38;2;248;248;242m [0m[38;2;190;132;255m0 [0m[38;2;190;132;255m1[0m
|
||||
[38;2;248;248;242mUUID=[0m[38;2;249;38;114m62F8-2047[0m[38;2;248;248;242m [0m[38;2;230;219;116m/boot [0m[3;38;2;253;151;31mvfat [0m[38;2;166;226;46mrw[0m[38;2;248;248;242m,[0m[38;2;166;226;46mrelatime[0m[38;2;248;248;242m,[0m[38;2;166;226;46mfmask[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31m0022[0m[38;2;248;248;242m,[0m[38;2;166;226;46mdmask[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31m0022[0m[38;2;248;248;242m,[0m[38;2;166;226;46mcodepage[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31m437[0m[38;2;248;248;242m,[0m[38;2;166;226;46miocharset[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31miso8859-1[0m[38;2;248;248;242m,[0m[38;2;166;226;46mshortname[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31mmixed[0m[38;2;248;248;242m,[0m[38;2;166;226;46merrors[0m[38;2;166;226;46m=[0m[3;38;2;253;151;31mremount-ro[0m[38;2;248;248;242m [0m[38;2;190;132;255m0 [0m[38;2;248;248;240m2[0m
|
||||
@@ -0,0 +1,43 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Load fonts[0m
|
||||
[38;2;249;38;114m@[0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;102;217;239murl[0m[38;2;255;255;255m([0m[38;2;230;219;116mh[0m[38;2;230;219;116mt[0m[38;2;230;219;116mt[0m[38;2;230;219;116mp[0m[38;2;230;219;116ms[0m[38;2;230;219;116m:[0m[38;2;230;219;116m/[0m[38;2;230;219;116m/[0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116mg[0m[38;2;230;219;116mo[0m[38;2;230;219;116mo[0m[38;2;230;219;116mg[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116mc[0m[38;2;230;219;116mo[0m[38;2;230;219;116mm[0m[38;2;230;219;116m/[0m[38;2;230;219;116mc[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m?[0m[38;2;230;219;116mf[0m[38;2;230;219;116ma[0m[38;2;230;219;116mm[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116my[0m[38;2;230;219;116m=[0m[38;2;230;219;116mL[0m[38;2;230;219;116mu[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116mi[0m[38;2;230;219;116ma[0m[38;2;230;219;116m|[0m[38;2;230;219;116mL[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116m:[0m[38;2;230;219;116m7[0m[38;2;230;219;116m0[0m[38;2;230;219;116m0[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Color scheme https://kuler.adobe.com/Salmon-on-Ice-color-theme-2291686/[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mdk[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m3E454C[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m dark[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mhl[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m2185C5[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m highlight[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mhll[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m7ECEFD[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m lighter highlight[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mlt[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255mFFF6E5[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m light[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mct[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255mFF7F66[0m[38;2;255;255;255m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m contrast[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Sizes[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mcontentWidth[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m750[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mmarginTop[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mmarginSide[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Fonts and Text[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mfont[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mLustria[0m[38;2;230;219;116m'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;102;217;239mserif[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mheaderFont[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mLato[0m[38;2;230;219;116m'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116msans[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mfontSize[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m19[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mfontSizeH1[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m50[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mfontSizeH2[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m30[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mparSep[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m40[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242mlinkSizeFactor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;190;132;255m.[0m[38;2;190;132;255m8[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Sizes for small devices[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallMarginTop[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m25[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallMarginSide[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m25[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallFontSize[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m18[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallFontSizeH1[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m40[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallFontSizeH2[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m28[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
[38;2;255;255;255m@[0m[38;2;248;248;242msmallParSep[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m25[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||
|
||||
[38;2;246;170;17m#[0m[38;2;246;170;17mwrapper[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mwidth[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmargin[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mauto[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmin-height[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mheight[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mauto[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mheight[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m100[0m[38;2;249;38;114m%[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239moverflow[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mhidden[0m[38;2;248;248;242m [0m[38;2;249;38;114m!important[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;255;255;255m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
@@ -0,0 +1,161 @@
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mio[0m[38;2;248;248;242m::[0m[38;2;248;248;242m{[0m[38;2;255;255;255mself[0m[38;2;248;248;242m,[0m[38;2;248;248;242m Write[0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mprocess[0m[38;2;248;248;242m::[0m[38;2;248;248;242mChild[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m::[0m[38;2;248;248;242merror[0m[38;2;248;248;242m::[0m[38;2;249;38;114m*[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m::[0m[38;2;248;248;242mless[0m[38;2;248;248;242m::[0m[38;2;248;248;242mretrieve_less_version[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m::[0m[38;2;248;248;242mpaging[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPagingMode[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mderive[0m[38;2;248;248;242m([0m[38;2;248;248;242mDebug[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mpub[0m[38;2;248;248;242m [0m[3;38;2;102;217;239menum[0m[38;2;248;248;242m [0m[38;2;166;226;46mOutputType[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m Pager[0m[38;2;248;248;242m([0m[38;2;248;248;242mChild[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m Stdout[0m[38;2;248;248;242m([0m[38;2;248;248;242mio[0m[38;2;248;248;242m::[0m[38;2;248;248;242mStdout[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[3;38;2;102;217;239mimpl[0m[38;2;248;248;242m [0m[38;2;166;226;46mOutputType[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mfrom_mode[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mmode[0m[38;2;248;248;242m:[0m[38;2;248;248;242m PagingMode, [0m[3;38;2;253;151;31mpager[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mOption[0m[38;2;248;248;242m<[0m[38;2;249;38;114m&[0m[3;38;2;102;217;239mstr[0m[38;2;248;248;242m>[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mResult[0m[38;2;248;248;242m<[0m[3;38;2;102;217;239mSelf[0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;255;255;255mself[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPagingMode[0m[38;2;248;248;242m::[0m[38;2;249;38;114m*[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m mode [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m Always [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mtry_pager[0m[38;2;248;248;242m([0m[38;2;190;132;255mfalse[0m[38;2;248;248;242m,[0m[38;2;248;248;242m pager[0m[38;2;248;248;242m)[0m[38;2;249;38;114m?[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m QuitIfOneScreen [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mtry_pager[0m[38;2;248;248;242m([0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m,[0m[38;2;248;248;242m pager[0m[38;2;248;248;242m)[0m[38;2;249;38;114m?[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m///[0m[38;2;117;113;94m Try to launch the pager. Fall back to stdout in case of errors.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mtry_pager[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mquit_if_one_screen[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mbool[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31mpager_from_config[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mOption[0m[38;2;248;248;242m<[0m[38;2;249;38;114m&[0m[3;38;2;102;217;239mstr[0m[38;2;248;248;242m>[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mResult[0m[38;2;248;248;242m<[0m[3;38;2;102;217;239mSelf[0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242menv[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mffi[0m[38;2;248;248;242m::[0m[38;2;248;248;242mOsString[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mpath[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPathBuf[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m::[0m[38;2;248;248;242mprocess[0m[38;2;248;248;242m::[0m[38;2;248;248;242m{[0m[38;2;248;248;242mCommand[0m[38;2;248;248;242m,[0m[38;2;248;248;242m Stdio[0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m replace_arguments_to_less [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m pager_from_env [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242menv[0m[38;2;248;248;242m::[0m[38;2;248;248;242mvar[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mBAT_PAGER[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242menv[0m[38;2;248;248;242m::[0m[38;2;248;248;242mvar[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mPAGER[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m([0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;248;248;242mbat_pager[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;248;248;242mbat_pager[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;249;38;114m_[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;248;248;242mpager[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m less needs to be called with the '-R' option in order to properly interpret the[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m ANSI color sequences printed by bat. If someone has set PAGER="less -F", we[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m therefore need to overwrite the arguments and add '-R'.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m or bats '--pager' command line option.[0m
|
||||
[38;2;248;248;242m replace_arguments_to_less [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;248;248;242mpager[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mNone[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m pager_from_config [0m[38;2;249;38;114m=[0m[38;2;248;248;242m pager_from_config[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m[38;2;248;248;242m([0m[38;2;248;248;242m|[0m[3;38;2;253;151;31mp[0m[38;2;248;248;242m|[0m[38;2;248;248;242m [0m[38;2;248;248;242mp[0m[38;2;248;248;242m.[0m[38;2;102;217;239mto_string[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m pager_from_config[0m[38;2;248;248;242m.[0m[38;2;102;217;239mis_some[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m replace_arguments_to_less [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m pager [0m[38;2;249;38;114m=[0m[38;2;248;248;242m pager_from_config[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mor[0m[38;2;248;248;242m([0m[38;2;248;248;242mpager_from_env[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239munwrap_or_else[0m[38;2;248;248;242m([0m[38;2;248;248;242m|[0m[38;2;248;248;242m|[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mString[0m[38;2;248;248;242m::[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mless[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m pagerflags [0m[38;2;249;38;114m=[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mshell_words[0m[38;2;248;248;242m::[0m[38;2;248;248;242msplit[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;248;248;242mpager[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239mchain_err[0m[38;2;248;248;242m([0m[38;2;248;248;242m|[0m[38;2;248;248;242m|[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mCould not parse pager command.[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;249;38;114m?[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m pagerflags[0m[38;2;248;248;242m.[0m[38;2;102;217;239msplit_first[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;248;248;242m([0m[38;2;248;248;242mpager_name[0m[38;2;248;248;242m,[0m[38;2;248;248;242m args[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m pager_path [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mPathBuf[0m[38;2;248;248;242m::[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m([0m[38;2;248;248;242mpager_name[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m pager_path[0m[38;2;248;248;242m.[0m[38;2;102;217;239mfile_stem[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;248;248;242mOsString[0m[38;2;248;248;242m::[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mbat[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m pager_path [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mPathBuf[0m[38;2;248;248;242m::[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mless[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m is_less [0m[38;2;249;38;114m=[0m[38;2;248;248;242m pager_path[0m[38;2;248;248;242m.[0m[38;2;102;217;239mfile_stem[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;248;248;242mOsString[0m[38;2;248;248;242m::[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mless[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m process [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m is_less [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m p [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mCommand[0m[38;2;248;248;242m::[0m[38;2;248;248;242mnew[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;248;248;242mpager_path[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m args[0m[38;2;248;248;242m.[0m[38;2;102;217;239mis_empty[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m replace_arguments_to_less [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239marg[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m--RAW-CONTROL-CHARS[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m quit_if_one_screen [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239marg[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m--quit-if-one-screen[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m versions of 'less'. Unfortunately, it also breaks mouse-wheel support.[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m See: http://www.greenwoodsoftware.com/less/news.530.html[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m For newer versions (530 or 558 on Windows), we omit '--no-init' as it[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m is not needed anymore.[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m [0m[38;2;102;217;239mretrieve_less_version[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mNone[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239marg[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m--no-init[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mSome[0m[38;2;248;248;242m([0m[38;2;248;248;242mversion[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mversion [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m530[0m[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mcfg![0m[38;2;248;248;242m([0m[38;2;248;248;242mwindows[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m&&[0m[38;2;248;248;242m version [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;190;132;255m558[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239marg[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116m--no-init[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239margs[0m[38;2;248;248;242m([0m[38;2;248;248;242margs[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239menv[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mLESSCHARSET[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mUTF-8[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m p[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m p [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mCommand[0m[38;2;248;248;242m::[0m[38;2;248;248;242mnew[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;248;248;242mpager_path[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m p[0m[38;2;248;248;242m.[0m[38;2;102;217;239margs[0m[38;2;248;248;242m([0m[38;2;248;248;242margs[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m p[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;248;248;242mprocess[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mstdin[0m[38;2;248;248;242m([0m[38;2;248;248;242mStdio[0m[38;2;248;248;242m::[0m[38;2;248;248;242mpiped[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mspawn[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mmap[0m[38;2;248;248;242m([0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPager[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239munwrap_or_else[0m[38;2;248;248;242m([0m[38;2;248;248;242m|[0m[38;2;248;248;242m_[0m[38;2;248;248;242m|[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mNone[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m([0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mstdout[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mSelf[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mStdout[0m[38;2;248;248;242m([0m[38;2;248;248;242mio[0m[38;2;248;248;242m::[0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m([0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mis_pager[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[3;38;2;253;151;31mself[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mbool[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPager[0m[38;2;248;248;242m([0m[38;2;249;38;114m_[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mself[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mnot[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m([0m[38;2;249;38;114mcrate[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mis_pager[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[3;38;2;253;151;31mself[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mbool[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mhandle[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;249;38;114mmut[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mself[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m->[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mResult[0m[38;2;248;248;242m<[0m[38;2;249;38;114m&[0m[38;2;249;38;114mmut[0m[38;2;248;248;242m dyn Write[0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46mOk[0m[38;2;248;248;242m([0m[38;2;249;38;114mmatch[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;255;255;255mself[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPager[0m[38;2;248;248;242m([0m[38;2;249;38;114mref[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m command[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m command[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;248;248;242mstdin[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mas_mut[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m.[0m[38;2;102;217;239mchain_err[0m[38;2;248;248;242m([0m[38;2;248;248;242m|[0m[38;2;248;248;242m|[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mCould not open stdin for pager[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;249;38;114m?[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mStdout[0m[38;2;248;248;242m([0m[38;2;249;38;114mref[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m handle[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m handle[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m#[0m[38;2;248;248;242m[[0m[38;2;248;248;242mcfg[0m[38;2;248;248;242m([0m[38;2;248;248;242mfeature [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m
|
||||
[3;38;2;102;217;239mimpl[0m[38;2;248;248;242m [0m[38;2;248;248;242mDrop [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;166;226;46mOutputType[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mdrop[0m[38;2;248;248;242m([0m[38;2;249;38;114m&[0m[38;2;249;38;114mmut[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mself[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;248;248;242mOutputType[0m[38;2;248;248;242m::[0m[38;2;248;248;242mPager[0m[38;2;248;248;242m([0m[38;2;249;38;114mref[0m[38;2;248;248;242m [0m[38;2;249;38;114mmut[0m[38;2;248;248;242m command[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;255;255;255mself[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;249;38;114m_[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m command[0m[38;2;248;248;242m.[0m[38;2;102;217;239mwait[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
@@ -0,0 +1,19 @@
|
||||
[38;2;249;38;114m@[0m[38;2;249;38;114mmixin[0m[38;2;248;248;242m [0m[38;2;166;226;46mbutton-base[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m {[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;249;38;114minclude[0m[38;2;248;248;242m typography[0m[38;2;255;255;255m([0m[38;2;102;217;239mbutton[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;249;38;114minclude[0m[38;2;248;248;242m ripple-surface[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;249;38;114minclude[0m[38;2;248;248;242m ripple-radius-bounded[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mdisplay[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239minline-flex[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mheight[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mbutton-height[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mborder[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mvertical-align[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mmiddle[0m[38;2;248;248;240m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m:[0m[38;2;166;226;46mhover[0m[38;2;248;248;242m [0m[38;2;248;248;240m{[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mpointer[0m[38;2;248;248;240m;[0m[38;2;248;248;242m }[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;166;226;46m:[0m[38;2;166;226;46mdisabled[0m[38;2;248;248;242m [0m[38;2;248;248;240m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcolor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m$[0m[38;2;255;255;255mmdc-button-disabled-ink-color[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mcursor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mdefault[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mpointer-events[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mnone[0m[38;2;248;248;240m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;240m}[0m
|
||||
[38;2;248;248;240m}[0m
|
||||
@@ -0,0 +1,9 @@
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m A comment[0m
|
||||
|
||||
[38;2;249;38;114mHost[0m[38;2;248;248;242m [0m[38;2;166;226;46mexample.com[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mUser[0m[38;2;248;248;242m [0m[38;2;230;219;116md[0m[38;2;230;219;116mummy[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mCompression[0m[38;2;248;248;242m [0m[38;2;190;132;255mno[0m
|
||||
|
||||
[38;2;249;38;114mHost[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;166;226;46m.co.uk[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mBatchMode[0m[38;2;248;248;242m [0m[38;2;190;132;255mno[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mGlobalKnownHostsFile[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m/etc/ssh/ssh_known_hosts[0m[38;2;230;219;116m"[0m
|
||||
@@ -0,0 +1,87 @@
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mpackage[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mauthors[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mDavid Peter <mail@david-peter.de>[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mcategories[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcommand-line-utilities[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mdescription[0m[38;2;248;248;242m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mA cat(1) clone with wings.[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mhomepage[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mhttps://github.com/sharkdp/bat[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mlicense[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mMIT/Apache-2.0[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mname[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbat[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mreadme[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mREADME.md[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mrepository[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mhttps://github.com/sharkdp/bat[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.15.4[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mexclude[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116massets/syntaxes/*[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116massets/themes/*[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mbuild[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbuild.rs[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114medition[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m2018[0m[38;2;230;219;116m'[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mfeatures[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mdefault[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mapplication[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Feature required for bat the application. Should be disabled when depending on[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m bat as a library.[0m
|
||||
[38;2;249;38;114mapplication[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116matty[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mclap[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mdirs[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mgit[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mlazy_static[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mliquid[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpaging[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mwild[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mregex-onig[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mgit[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mgit2[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Support indicating git modifications[0m
|
||||
[38;2;249;38;114mpaging[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mshell-words[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Support applying a pager on the output[0m
|
||||
[38;2;249;38;114mregex-onig[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116msyntect/regex-onig[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Use the "oniguruma" regex engine[0m
|
||||
[38;2;249;38;114mregex-fancy[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116msyntect/regex-fancy[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Use the rust-only "fancy-regex" engine[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdependencies[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114matty[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.2.14[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mansi_term[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m^0.12.1[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mansi_colours[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m^1.0[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mconsole[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.11.3[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mdirs[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m3.0[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mlazy_static[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1.4[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mwild[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m2.0[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mcontent_inspector[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.2.4[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mencoding[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.2[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mshell-words[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1.0.0[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114municode-width[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.1.8[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mglobset[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.4[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mserde[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1.0[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114mfeatures[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mderive[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mserde_yaml[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.8[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114msemver[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.10[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mpath_abs[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.5[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114mdefault-features[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdependencies[0m[38;2;248;248;242m.[0m[38;2;166;226;46mgit2[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.13[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m
|
||||
[38;2;249;38;114mdefault-features[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdependencies[0m[38;2;248;248;242m.[0m[38;2;166;226;46msyntect[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m4.2.0[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mdefault-features[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
[38;2;249;38;114mfeatures[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116mparsing[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116myaml-load[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mdump-load[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mdump-create[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdependencies[0m[38;2;248;248;242m.[0m[38;2;166;226;46mclap[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m2.33[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m
|
||||
[38;2;249;38;114mdefault-features[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
[38;2;249;38;114mfeatures[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m"[0m[38;2;230;219;116msuggestions[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mcolor[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mwrap_help[0m[38;2;230;219;116m"[0m[38;2;248;248;242m][0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdependencies[0m[38;2;248;248;242m.[0m[38;2;166;226;46merror-chain[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.12[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mdefault-features[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mfalse[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mdev-dependencies[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mtempdir[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.3[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114massert_cmd[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1.0.1[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114mpredicates[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m1.0.5[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mbuild-dependencies[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mclap[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m2.33[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;249;38;114mliquid[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;249;38;114mversion[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m0.21[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;249;38;114moptional[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46mprofile[0m[38;2;248;248;242m.[0m[38;2;166;226;46mrelease[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mlto[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m
|
||||
[38;2;249;38;114mcodegen-units[0m[38;2;248;248;242m [0m[38;2;248;248;242m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
script_directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
output_directory=$(mktemp -d --suffix=.bat-syntax-regression-test)
|
||||
|
||||
"$script_directory"/create_highlighted_versions.py --output="$output_directory"
|
||||
|
||||
echo
|
||||
|
||||
"$script_directory"/compare_highlighted_versions.py \
|
||||
"$script_directory/highlighted" \
|
||||
"$output_directory"
|
||||
@@ -0,0 +1,35 @@
|
||||
# quicksort.awk --- Quicksort algorithm, with user-supplied
|
||||
# comparison function
|
||||
#
|
||||
# Arnold Robbins, arnold@skeeve.com, Public Domain
|
||||
# January 2009
|
||||
|
||||
|
||||
# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
|
||||
# or almost any algorithms or computer science text.
|
||||
#
|
||||
# Adapted from K&R-II, page 110
|
||||
|
||||
function quicksort(data, left, right, less_than, i, last)
|
||||
{
|
||||
if (left >= right) # do nothing if array contains fewer
|
||||
return # than two elements
|
||||
|
||||
quicksort_swap(data, left, int((left + right) / 2))
|
||||
last = left
|
||||
for (i = left + 1; i <= right; i++)
|
||||
if (@less_than(data[i], data[left]))
|
||||
quicksort_swap(data, ++last, i)
|
||||
quicksort_swap(data, left, last)
|
||||
quicksort(data, left, last - 1, less_than)
|
||||
quicksort(data, last + 1, right, less_than)
|
||||
}
|
||||
|
||||
# quicksort_swap --- helper function for quicksort, should really be inline
|
||||
|
||||
function quicksort_swap(data, i, j, temp)
|
||||
{
|
||||
temp = data[i]
|
||||
data[i] = data[j]
|
||||
data[j] = temp
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
Return-Path: <user@example.com>
|
||||
Received: from mail.example ([1.1.1.1])
|
||||
by mail.example with LMTP
|
||||
id 123
|
||||
(envelope-from <user@example.com>)
|
||||
for <a@b>; Sun, 13 Oct 2019 13:53:24 +0000
|
||||
From: "User, Test" <user@example.com>
|
||||
To: "User2, Test" <user2@example.com>
|
||||
Subject:
|
||||
Date: Sun, 13 Oct 2019 13:53:08 +0000
|
||||
Accept-Language: de-DE, en-US
|
||||
Content-Language: de-DE
|
||||
X-MS-Has-Attach: yes
|
||||
MIME-Version: 1.0
|
||||
|
||||
Test
|
||||
@@ -0,0 +1,7 @@
|
||||
# Static information about the filesystems.
|
||||
# See fstab(5) for details.
|
||||
|
||||
# <file system> <dir> <type> <options> <dump> <pass>
|
||||
|
||||
UUID=9e6faddf-31ab-3f3e-9b50-2ad4fbc2ea8b / ext4 rw,relatime,data=ordered 0 1
|
||||
UUID=62F8-2047 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 2
|
||||
@@ -0,0 +1,43 @@
|
||||
// Load fonts
|
||||
@import url(https://fonts.googleapis.com/css?family=Lustria|Lato:700);
|
||||
|
||||
// Color scheme https://kuler.adobe.com/Salmon-on-Ice-color-theme-2291686/
|
||||
@dk: #3E454C; // dark
|
||||
@hl: #2185C5; // highlight
|
||||
@hll: #7ECEFD; // lighter highlight
|
||||
@lt: #FFF6E5; // light
|
||||
@ct: #FF7F66; // contrast
|
||||
|
||||
// Sizes
|
||||
@contentWidth: 750px;
|
||||
@marginTop: 50px;
|
||||
@marginSide: 100px;
|
||||
|
||||
// Fonts and Text
|
||||
@font: 'Lustria', serif;
|
||||
@headerFont: 'Lato', sans;
|
||||
|
||||
@fontSize: 19px;
|
||||
@fontSizeH1: 50px;
|
||||
@fontSizeH2: 30px;
|
||||
@parSep: 40px;
|
||||
|
||||
@linkSizeFactor: 0.8;
|
||||
|
||||
// Sizes for small devices
|
||||
@smallMarginTop: 25px;
|
||||
@smallMarginSide: 25px;
|
||||
@smallFontSize: 18px;
|
||||
@smallFontSizeH1: 40px;
|
||||
@smallFontSizeH2: 28px;
|
||||
@smallParSep: 25px;
|
||||
|
||||
#wrapper {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
overflow: hidden !important;
|
||||
position: relative;
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
use std::io::{self, Write};
|
||||
#[cfg(feature = "paging")]
|
||||
use std::process::Child;
|
||||
|
||||
use crate::error::*;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::less::retrieve_less_version;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum OutputType {
|
||||
#[cfg(feature = "paging")]
|
||||
Pager(Child),
|
||||
Stdout(io::Stdout),
|
||||
}
|
||||
|
||||
impl OutputType {
|
||||
#[cfg(feature = "paging")]
|
||||
pub fn from_mode(mode: PagingMode, pager: Option<&str>) -> Result<Self> {
|
||||
use self::PagingMode::*;
|
||||
Ok(match mode {
|
||||
Always => OutputType::try_pager(false, pager)?,
|
||||
QuitIfOneScreen => OutputType::try_pager(true, pager)?,
|
||||
_ => OutputType::stdout(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Try to launch the pager. Fall back to stdout in case of errors.
|
||||
#[cfg(feature = "paging")]
|
||||
fn try_pager(quit_if_one_screen: bool, pager_from_config: Option<&str>) -> Result<Self> {
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
let mut replace_arguments_to_less = false;
|
||||
|
||||
let pager_from_env = match (env::var("BAT_PAGER"), env::var("PAGER")) {
|
||||
(Ok(bat_pager), _) => Some(bat_pager),
|
||||
(_, Ok(pager)) => {
|
||||
// less needs to be called with the '-R' option in order to properly interpret the
|
||||
// ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
|
||||
// therefore need to overwrite the arguments and add '-R'.
|
||||
//
|
||||
// We only do this for PAGER (as it is not specific to 'bat'), not for BAT_PAGER
|
||||
// or bats '--pager' command line option.
|
||||
replace_arguments_to_less = true;
|
||||
Some(pager)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let pager_from_config = pager_from_config.map(|p| p.to_string());
|
||||
|
||||
if pager_from_config.is_some() {
|
||||
replace_arguments_to_less = false;
|
||||
}
|
||||
|
||||
let pager = pager_from_config
|
||||
.or(pager_from_env)
|
||||
.unwrap_or_else(|| String::from("less"));
|
||||
|
||||
let pagerflags =
|
||||
shell_words::split(&pager).chain_err(|| "Could not parse pager command.")?;
|
||||
|
||||
match pagerflags.split_first() {
|
||||
Some((pager_name, args)) => {
|
||||
let mut pager_path = PathBuf::from(pager_name);
|
||||
|
||||
if pager_path.file_stem() == Some(&OsString::from("bat")) {
|
||||
pager_path = PathBuf::from("less");
|
||||
}
|
||||
|
||||
let is_less = pager_path.file_stem() == Some(&OsString::from("less"));
|
||||
|
||||
let mut process = if is_less {
|
||||
let mut p = Command::new(&pager_path);
|
||||
if args.is_empty() || replace_arguments_to_less {
|
||||
p.arg("--RAW-CONTROL-CHARS");
|
||||
if quit_if_one_screen {
|
||||
p.arg("--quit-if-one-screen");
|
||||
}
|
||||
|
||||
// Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
|
||||
// versions of 'less'. Unfortunately, it also breaks mouse-wheel support.
|
||||
//
|
||||
// See: http://www.greenwoodsoftware.com/less/news.530.html
|
||||
//
|
||||
// For newer versions (530 or 558 on Windows), we omit '--no-init' as it
|
||||
// is not needed anymore.
|
||||
match retrieve_less_version() {
|
||||
None => {
|
||||
p.arg("--no-init");
|
||||
}
|
||||
Some(version)
|
||||
if (version < 530 || (cfg!(windows) && version < 558)) =>
|
||||
{
|
||||
p.arg("--no-init");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
p.args(args);
|
||||
}
|
||||
p.env("LESSCHARSET", "UTF-8");
|
||||
p
|
||||
} else {
|
||||
let mut p = Command::new(&pager_path);
|
||||
p.args(args);
|
||||
p
|
||||
};
|
||||
|
||||
Ok(process
|
||||
.stdin(Stdio::piped())
|
||||
.spawn()
|
||||
.map(OutputType::Pager)
|
||||
.unwrap_or_else(|_| OutputType::stdout()))
|
||||
}
|
||||
None => Ok(OutputType::stdout()),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn stdout() -> Self {
|
||||
OutputType::Stdout(io::stdout())
|
||||
}
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
pub(crate) fn is_pager(&self) -> bool {
|
||||
if let OutputType::Pager(_) = self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "paging"))]
|
||||
pub(crate) fn is_pager(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn handle(&mut self) -> Result<&mut dyn Write> {
|
||||
Ok(match *self {
|
||||
#[cfg(feature = "paging")]
|
||||
OutputType::Pager(ref mut command) => command
|
||||
.stdin
|
||||
.as_mut()
|
||||
.chain_err(|| "Could not open stdin for pager")?,
|
||||
OutputType::Stdout(ref mut handle) => handle,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
impl Drop for OutputType {
|
||||
fn drop(&mut self) {
|
||||
if let OutputType::Pager(ref mut command) = *self {
|
||||
let _ = command.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
This file has been copied from https://sass-lang.com/documentation/syntax
|
||||
|
||||
|
||||
LICENSE:
|
||||
|
||||
|
||||
Copyright (c) 2006-2018 Hampton Catlin, Natalie Weizenbaum, Chris Eppstein, and
|
||||
Jina Anne
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,19 @@
|
||||
@mixin button-base() {
|
||||
@include typography(button);
|
||||
@include ripple-surface;
|
||||
@include ripple-radius-bounded;
|
||||
|
||||
display: inline-flex;
|
||||
position: relative;
|
||||
height: $button-height;
|
||||
border: none;
|
||||
vertical-align: middle;
|
||||
|
||||
&:hover { cursor: pointer; }
|
||||
|
||||
&:disabled {
|
||||
color: $mdc-button-disabled-ink-color;
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
# A comment
|
||||
|
||||
Host example.com
|
||||
User dummy
|
||||
Compression no
|
||||
|
||||
Host *.co.uk
|
||||
BatchMode no
|
||||
GlobalKnownHostsFile "/etc/ssh/ssh_known_hosts"
|
||||
@@ -0,0 +1,87 @@
|
||||
[package]
|
||||
authors = ["David Peter <mail@david-peter.de>"]
|
||||
categories = ["command-line-utilities"]
|
||||
description="A cat(1) clone with wings."
|
||||
homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.15.4"
|
||||
exclude = [
|
||||
"assets/syntaxes/*",
|
||||
"assets/themes/*",
|
||||
]
|
||||
build = "build.rs"
|
||||
edition = '2018'
|
||||
|
||||
[features]
|
||||
default = ["application"]
|
||||
# Feature required for bat the application. Should be disabled when depending on
|
||||
# bat as a library.
|
||||
application = [
|
||||
"atty",
|
||||
"clap",
|
||||
"dirs",
|
||||
"git",
|
||||
"lazy_static",
|
||||
"liquid",
|
||||
"paging",
|
||||
"wild",
|
||||
"regex-onig",
|
||||
]
|
||||
git = ["git2"] # Support indicating git modifications
|
||||
paging = ["shell-words"] # Support applying a pager on the output
|
||||
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
|
||||
[dependencies]
|
||||
atty = { version = "0.2.14", optional = true }
|
||||
ansi_term = "^0.12.1"
|
||||
ansi_colours = "^1.0"
|
||||
console = "0.11.3"
|
||||
dirs = { version = "3.0", optional = true }
|
||||
lazy_static = { version = "1.4", optional = true }
|
||||
wild = { version = "2.0", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
encoding = "0.2"
|
||||
shell-words = { version = "1.0.0", optional = true }
|
||||
unicode-width = "0.1.8"
|
||||
globset = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.8"
|
||||
semver = "0.10"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
|
||||
[dependencies.git2]
|
||||
version = "0.13"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.syntect]
|
||||
version = "4.2.0"
|
||||
default-features = false
|
||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2.33"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["suggestions", "color", "wrap_help"]
|
||||
|
||||
[dependencies.error-chain]
|
||||
version = "0.12"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
assert_cmd = "1.0.1"
|
||||
predicates = "1.0.5"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "2.33", optional = true }
|
||||
liquid = { version = "0.21", optional = true }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
python create_highlighted_versions.py -O highlighted
|
||||
Reference in New Issue
Block a user