mirror of
https://github.com/sharkdp/bat
synced 2026-08-04 19:01:44 +00:00
Compare commits
284 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3aea51455b | |||
| f827ed338b | |||
| 73dab51ad1 | |||
| 9328007d05 | |||
| 8d173cd960 | |||
| fb0f12a221 | |||
| 9866408b72 | |||
| aaac56d895 | |||
| 516da7719f | |||
| d4df0b4405 | |||
| bfa9c3bef6 | |||
| 2904f24ea8 | |||
| 91a347bf6d | |||
| e219c8fc03 | |||
| 9eb26b702c | |||
| c933be926d | |||
| fc88040b31 | |||
| 5db3c93057 | |||
| aa442b5795 | |||
| 09711cd6f9 | |||
| b16cacc758 | |||
| 51451a9636 | |||
| fbc03da997 | |||
| 1a610dbdd2 | |||
| a30e3c9066 | |||
| 613b41e357 | |||
| d405aa98d5 | |||
| 285b1556a9 | |||
| 8321cc661c | |||
| 848ceb6f10 | |||
| 3559079de0 | |||
| b3ab843954 | |||
| 867cf63dd9 | |||
| 0b44aa6f68 | |||
| aa09a9dc04 | |||
| 7c4edacb2b | |||
| 782ede5db5 | |||
| 1537733e6b | |||
| ba0d43672b | |||
| 4384d25c79 | |||
| b6e3786529 | |||
| 6fff01397d | |||
| 0cd52e5be1 | |||
| c14dd34dca | |||
| e04fbd1992 | |||
| d89fa3ebc2 | |||
| db57454f3f | |||
| 8f93844427 | |||
| 52f84b063c | |||
| 2e7f2b6c07 | |||
| 35347c2310 | |||
| b489fc75c9 | |||
| fc24cb2a77 | |||
| 2540311cdf | |||
| 3880888286 | |||
| 5a806c2149 | |||
| 8a926d511a | |||
| 8885285b10 | |||
| d1f0181947 | |||
| b147443c32 | |||
| b8a18d3ebb | |||
| 694b31909a | |||
| a98811b6d7 | |||
| cfc505e1e5 | |||
| 3af3549232 | |||
| 643f0bcbe3 | |||
| 9db9a38565 | |||
| ca60937c2e | |||
| 2aa3ed9da8 | |||
| 7768433d09 | |||
| c569774e1a | |||
| 0371f55541 | |||
| bc35592fd9 | |||
| f5d834407e | |||
| 557a748ac7 | |||
| 3f10f71ad2 | |||
| 7b6388b19f | |||
| b98ec4bbc5 | |||
| 94fd481f36 | |||
| 94496df3b0 | |||
| 0e5ea9c354 | |||
| 7eabb5e05a | |||
| 9ad401be87 | |||
| f874c8e4db | |||
| 025c5c061b | |||
| 573f34d757 | |||
| eac36dd3b5 | |||
| 70cf8a4ec5 | |||
| 37d0d8984c | |||
| 2e8c0a39db | |||
| deec2902e4 | |||
| e3343759b7 | |||
| fa72f86e17 | |||
| 6527126e50 | |||
| 4aec022065 | |||
| a26c5b8219 | |||
| d36b091fd7 | |||
| 3dcf02549e | |||
| e402011a73 | |||
| dc1620d1f0 | |||
| c48e779e8a | |||
| dd0d44bbb3 | |||
| 060b9981b5 | |||
| b25713938d | |||
| 5b09561114 | |||
| fcde4824d5 | |||
| b0e5828d3f | |||
| b7d499d1be | |||
| 1ae16fca90 | |||
| 0e2bef3b79 | |||
| 221c9815a5 | |||
| c5c683f67c | |||
| 149a0177cd | |||
| 252e5a6b13 | |||
| faa27ed6e3 | |||
| f3227c259e | |||
| 2cfeebab90 | |||
| 8dd67cca0c | |||
| eda72c31b2 | |||
| 7809008016 | |||
| c2c2b0211a | |||
| dd6f57e107 | |||
| dfe7a60140 | |||
| fc30277cfa | |||
| 02e6ff4183 | |||
| e3b1142364 | |||
| 8832ff3c6a | |||
| 505ff10dc6 | |||
| 9a3a5545e7 | |||
| 43919066ad | |||
| 7ada963ec2 | |||
| 4c523af1ab | |||
| c5c28eb05b | |||
| 22924532d0 | |||
| 7c227169a4 | |||
| 8e4b0b4377 | |||
| 6d27df3b77 | |||
| 73d14f4655 | |||
| 19b8c53c46 | |||
| cd7be018fe | |||
| 03a2710a08 | |||
| 09fbabb0b8 | |||
| de6cb75f4b | |||
| 83c9cb7907 | |||
| 7ffb04a17a | |||
| c38c186d26 | |||
| e22a9a69b1 | |||
| 59f9adc706 | |||
| fed30b1b36 | |||
| 411d68e839 | |||
| 77d42a17c6 | |||
| e7c55bffe9 | |||
| da10166625 | |||
| b6b7262962 | |||
| 3ed83913b2 | |||
| 63460f4bf9 | |||
| c67b439752 | |||
| 2b44940f81 | |||
| 26136be903 | |||
| 6a52f69b58 | |||
| 60406c7c2d | |||
| 2465438ec3 | |||
| 99a61580e1 | |||
| dec94b4111 | |||
| ebb97e94a9 | |||
| 5e1f9fadf4 | |||
| fe08de846d | |||
| 35e3c51b75 | |||
| 59c9105c25 | |||
| b458292a69 | |||
| 78aed2cb69 | |||
| 46487b201f | |||
| 939a6a5f4d | |||
| caf0743811 | |||
| 9ccb667653 | |||
| b600f62ab6 | |||
| ace655e164 | |||
| 21ae26cb17 | |||
| 478233f795 | |||
| e87c554ccd | |||
| df33ed05dd | |||
| c9efdd68ed | |||
| 8381945cb5 | |||
| 2046b47739 | |||
| 0c302f088a | |||
| a41db63907 | |||
| 3573c48e98 | |||
| e94980bfd0 | |||
| 5422982207 | |||
| 4fe5497d19 | |||
| 1b549ecc66 | |||
| b5bdba8b16 | |||
| 522c97f5ad | |||
| 7fbb3a5352 | |||
| b3f34529b5 | |||
| d388d07e9f | |||
| c76e27851c | |||
| 8c0dcf3b57 | |||
| 962b3a78c0 | |||
| aa5b941ed5 | |||
| af8a8035e8 | |||
| 037a66c57b | |||
| 1a04dcf10f | |||
| 2eae8b578e | |||
| 17189fce9b | |||
| a0225018e6 | |||
| 361b7aa0da | |||
| 334590932a | |||
| 3f4638204f | |||
| 5e7061b9f6 | |||
| 7a1cd5226f | |||
| 285ac75738 | |||
| 00ff54be4e | |||
| aab35e3faa | |||
| bfa5342331 | |||
| c0d945c0ac | |||
| 22bdc7c20f | |||
| 3ed0081f1f | |||
| 6d0e7650c3 | |||
| 552545fe5f | |||
| dcfe883f4b | |||
| f45fa5e187 | |||
| 05e9da390f | |||
| cc0f8ca813 | |||
| 9c16571347 | |||
| 2765c6ba3b | |||
| 28f3f3c9c9 | |||
| 73d9a95862 | |||
| 9c9a9ac452 | |||
| 29ea396c31 | |||
| 171d215f91 | |||
| cc6109a751 | |||
| 47bb4a9c0f | |||
| b149ea91dd | |||
| 6d1c7d5f57 | |||
| 07bd7503c5 | |||
| 1b5af89ddd | |||
| 3d07dec8fd | |||
| a63bb08eda | |||
| e0207f8167 | |||
| 3099f51ba7 | |||
| 19e7763f35 | |||
| 73cff42ec9 | |||
| b349155f2f | |||
| ab4c120ea5 | |||
| 947133d295 | |||
| bf96e6e642 | |||
| cffacad306 | |||
| cc7b89faf8 | |||
| c1e4746d50 | |||
| 8331eec7fc | |||
| 0547068ed0 | |||
| 18d8389785 | |||
| 165d25d941 | |||
| c4fb77b042 | |||
| 973ea984c8 | |||
| 3e9afe2974 | |||
| 73c16574e6 | |||
| 60e00d49a9 | |||
| 2d22c705ba | |||
| 68d525cd8b | |||
| c3fc1b88fe | |||
| 84b0702399 | |||
| f3489ffa29 | |||
| 8e6ba2a3e1 | |||
| 48e799e7a6 | |||
| bc01999f0d | |||
| b0fcb3065f | |||
| 94d8cd5100 | |||
| 5596c6133b | |||
| 304332e380 | |||
| fb989d8c94 | |||
| 026220b960 | |||
| 543a253bc1 | |||
| 8f8e44e87a | |||
| 2da11097f9 | |||
| d124ebeced | |||
| 986d0e9777 | |||
| f4202361b4 | |||
| 6d981498d8 | |||
| bd2e9917da | |||
| a6810e3353 | |||
| e26ec31463 | |||
| e3bc41dbe6 |
@@ -7,33 +7,41 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Hey there, thanks for creating an issue!
|
||||
|
||||
In order to reproduce your issue, we might need to know a little bit more about the environment
|
||||
which you're running `bat` on.
|
||||
|
||||
If you're on Linux or MacOS:
|
||||
Please run the script at https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh and
|
||||
paste the output at the bottom of the bug report.
|
||||
|
||||
If you're on Windows:
|
||||
Please tell us about your Windows Version (e.g. "Windows 10 1908") at the
|
||||
bottom of the bug report.
|
||||
-->
|
||||
|
||||
**What version of `bat` are you using?**
|
||||
[paste the output of `bat --version` here]
|
||||
<!-- Hey there, thank you for creating an issue! -->
|
||||
|
||||
**Describe the bug you encountered:**
|
||||
|
||||
...
|
||||
|
||||
**What did you expect to happen instead?**
|
||||
|
||||
...
|
||||
|
||||
|
||||
**How did you install `bat`?**
|
||||
|
||||
<!-- apt-get, homebrew, GitHub release, etc. -->
|
||||
|
||||
---
|
||||
|
||||
[paste the output of `info.sh` here]
|
||||
**bat version and environment**
|
||||
|
||||
<!--
|
||||
In order to reproduce your issue, please add some information about the environment
|
||||
in which you're running bat. To do this, run the full `bat` command that demonstrates
|
||||
the bug, and attach the `--diagnostic` option:
|
||||
|
||||
bat [other options and arguments…] --diagnostic
|
||||
|
||||
Finally, paste the Markdown output here. Please make sure that it does not reveal any
|
||||
personal information.
|
||||
|
||||
|
||||
If you are running bat 0.17.1 or older (where --diagnostic is not available), please
|
||||
run the script at
|
||||
|
||||
https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
|
||||
|
||||
(click "Raw" to get the actual source code) and paste the Markdown output here. If you
|
||||
are on Windows, please let us know your bat version and your Windows version.
|
||||
-->
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
ignore:
|
||||
- dependency-name: git2
|
||||
versions:
|
||||
- 0.13.17
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
+274
-296
@@ -1,18 +1,22 @@
|
||||
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"
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.45.0"
|
||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
min_version:
|
||||
name: Minimum supported rust version
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -22,14 +26,20 @@ jobs:
|
||||
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
|
||||
default: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
- name: Test
|
||||
components: clippy
|
||||
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: --all-targets --all-features
|
||||
- name: Run tests
|
||||
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
|
||||
name: Run tests with updated syntaxes and themes
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -69,30 +79,36 @@ jobs:
|
||||
run: bat --list-languages
|
||||
- name: List of themes
|
||||
run: bat --list-themes
|
||||
- name: Check documentation
|
||||
env:
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: doc
|
||||
args: --no-deps --document-private-items --all-features
|
||||
|
||||
build:
|
||||
name: Build
|
||||
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
|
||||
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 }
|
||||
- { os: ubuntu-18.04 , target: arm-unknown-linux-gnueabihf , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: true }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu }
|
||||
- { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: true }
|
||||
- { os: macos-10.15 , target: x86_64-apple-darwin }
|
||||
# - { os: windows-2019 , target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
|
||||
- { os: windows-2019 , target: i686-pc-windows-msvc }
|
||||
- { os: windows-2019 , target: x86_64-pc-windows-gnu }
|
||||
- { os: windows-2019 , target: x86_64-pc-windows-msvc }
|
||||
steps:
|
||||
- name: Git checkout
|
||||
- name: Checkout source code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install prerequisites
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -100,121 +116,24 @@ jobs:
|
||||
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
|
||||
|
||||
- name: Extract crate information
|
||||
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'
|
||||
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
|
||||
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ steps.vars.outputs.TOOLCHAIN }}
|
||||
toolchain: stable
|
||||
target: ${{ matrix.job.target }}
|
||||
override: true
|
||||
profile: minimal # minimal component installation (ie, no documentation)
|
||||
- name: Info
|
||||
|
||||
- name: Show version information (Rust, cargo, GCC)
|
||||
shell: bash
|
||||
run: |
|
||||
gcc --version || true
|
||||
@@ -223,221 +142,280 @@ jobs:
|
||||
rustup default
|
||||
cargo -V
|
||||
rustc -V
|
||||
|
||||
- name: Build
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }}
|
||||
use-cross: ${{ matrix.job.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
|
||||
args: --release --target=${{ matrix.job.target }}
|
||||
|
||||
- name: Strip debug information from executable
|
||||
id: strip
|
||||
shell: bash
|
||||
run: |
|
||||
ARCHIVE_DIR='${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/'
|
||||
# Binary
|
||||
cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' "$ARCHIVE_DIR"
|
||||
# Figure out suffix of binary
|
||||
EXE_suffix=""
|
||||
case ${{ matrix.job.target }} in
|
||||
*-pc-windows-*) EXE_suffix=".exe" ;;
|
||||
esac;
|
||||
|
||||
# `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
|
||||
# Figure out what strip tool to use if any
|
||||
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;
|
||||
|
||||
# Setup paths
|
||||
BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/"
|
||||
mkdir -p "${BIN_DIR}"
|
||||
BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}"
|
||||
BIN_PATH="${BIN_DIR}/${BIN_NAME}"
|
||||
|
||||
# Copy the release build binary to the result location
|
||||
cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}"
|
||||
|
||||
# Also strip if possible
|
||||
if [ -n "${STRIP}" ]; then
|
||||
"${STRIP}" "${BIN_PATH}"
|
||||
fi
|
||||
|
||||
# Let subsequent steps know where to find the (stripped) bin
|
||||
echo ::set-output name=BIN_PATH::${BIN_PATH}
|
||||
echo ::set-output name=BIN_NAME::${BIN_NAME}
|
||||
|
||||
- name: Set testing options
|
||||
id: test-options
|
||||
shell: bash
|
||||
run: |
|
||||
# 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}
|
||||
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: test
|
||||
args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
|
||||
|
||||
- name: Run bat
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: run
|
||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs
|
||||
|
||||
- name: Show diagnostics (bat --diagnostic)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: run
|
||||
args: --target=${{ matrix.job.target }} -- --paging=never --color=always --theme=ansi Cargo.toml src/config.rs --diagnostic
|
||||
|
||||
- name: "Feature check: regex-onig"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig
|
||||
|
||||
- name: "Feature check: regex-onig,git"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git
|
||||
|
||||
- name: "Feature check: regex-onig,paging"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,paging
|
||||
|
||||
- name: "Feature check: regex-onig,git,paging"
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
use-cross: ${{ matrix.job.use-cross }}
|
||||
command: check
|
||||
args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
|
||||
|
||||
- name: Create tarball
|
||||
id: package
|
||||
shell: bash
|
||||
run: |
|
||||
PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
|
||||
PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }}
|
||||
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
|
||||
echo ::set-output name=PKG_NAME::${PKG_NAME}
|
||||
|
||||
PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package"
|
||||
ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/"
|
||||
mkdir -p "${ARCHIVE_DIR}"
|
||||
mkdir -p "${ARCHIVE_DIR}/autocomplete"
|
||||
|
||||
# Binary
|
||||
cp "${{ steps.strip.outputs.BIN_PATH }}" "$ARCHIVE_DIR"
|
||||
|
||||
# Man page
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "$ARCHIVE_DIR"
|
||||
|
||||
# README and LICENSE files
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "$ARCHIVE_DIR"
|
||||
# README, LICENSE and CHANGELOG files
|
||||
cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR"
|
||||
|
||||
# Autocompletion files
|
||||
cp 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/completions/bat.fish "$ARCHIVE_DIR/autocomplete/${{ env.PROJECT_NAME }}.fish"
|
||||
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
|
||||
pushd "${PKG_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 }}'/* ;;
|
||||
*-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;;
|
||||
*) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;;
|
||||
esac;
|
||||
popd >/dev/null
|
||||
|
||||
# Debian package
|
||||
if [ -n "${{ steps.vars.outputs.DPKG_NAME }}" ]; then
|
||||
DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg"
|
||||
# Let subsequent steps know where to find the compressed package
|
||||
echo ::set-output name=PKG_PATH::"${PKG_STAGING}/${PKG_NAME}"
|
||||
|
||||
# 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
|
||||
- name: Create Debian package
|
||||
id: debian-package
|
||||
shell: bash
|
||||
if: startsWith(matrix.job.os, 'ubuntu')
|
||||
run: |
|
||||
COPYRIGHT_YEARS="2018 - "$(date "+%Y")
|
||||
DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package"
|
||||
DPKG_DIR="${DPKG_STAGING}/dpkg"
|
||||
mkdir -p "${DPKG_DIR}"
|
||||
|
||||
# Man page
|
||||
install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ env.PROJECT_NAME }}'-*/out/assets/manual/bat.1 "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
gzip --best "${DPKG_DIR}/usr/share/man/man1/${{ env.PROJECT_NAME }}.1"
|
||||
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;
|
||||
DPKG_VERSION=${PROJECT_VERSION}
|
||||
|
||||
# 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 }}"
|
||||
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 ;;
|
||||
*) DPKG_ARCH=notset ;;
|
||||
esac;
|
||||
|
||||
# README and LICENSE
|
||||
install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-MIT"
|
||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/LICENSE-APACHE"
|
||||
DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb"
|
||||
echo ::set-output name=DPKG_NAME::${DPKG_NAME}
|
||||
|
||||
cat > "${DPKG_DIR}/usr/share/doc/${{ env.PROJECT_NAME }}/copyright" <<EOF
|
||||
# Binary
|
||||
install -Dm755 "${{ steps.strip.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.strip.outputs.BIN_NAME }}"
|
||||
|
||||
# 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/${DPKG_BASENAME}/README.md"
|
||||
install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT"
|
||||
install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE"
|
||||
install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"
|
||||
gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog"
|
||||
|
||||
cat > "${DPKG_DIR}/usr/share/doc/${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.
|
||||
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.
|
||||
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/${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 }}
|
||||
Package: ${DPKG_BASENAME}
|
||||
Version: ${DPKG_VERSION}
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: ${{ env.PROJECT_MAINTAINER }}
|
||||
Homepage: ${{ env.PROJECT_HOMEPAGE }}
|
||||
Architecture: ${{ steps.vars.outputs.DPKG_ARCH }}
|
||||
Architecture: ${DPKG_ARCH}
|
||||
Provides: ${{ env.PROJECT_NAME }}
|
||||
Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }}
|
||||
Description: A cat(1) clone with wings.
|
||||
A cat(1) clone with syntax highlighting and Git integration.
|
||||
Conflicts: ${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 }}
|
||||
DPKG_PATH="${DPKG_STAGING}/${DPKG_NAME}"
|
||||
echo ::set-output name=DPKG_PATH::${DPKG_PATH}
|
||||
|
||||
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@v2
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
# build dpkg
|
||||
fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}"
|
||||
|
||||
- name: "Artifact upload: tarball"
|
||||
uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: ${{ steps.package.outputs.PKG_NAME }}
|
||||
path: ${{ steps.package.outputs.PKG_PATH }}
|
||||
|
||||
- name: "Artifact upload: Debian package"
|
||||
uses: actions/upload-artifact@master
|
||||
if: steps.debian-package.outputs.DPKG_NAME
|
||||
with:
|
||||
name: ${{ steps.debian-package.outputs.DPKG_NAME }}
|
||||
path: ${{ steps.debian-package.outputs.DPKG_PATH }}
|
||||
|
||||
- name: Check for release
|
||||
id: is-release
|
||||
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
|
||||
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
|
||||
echo ::set-output name=IS_RELEASE::${IS_RELEASE}
|
||||
|
||||
- name: Publish archives and packages
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: steps.is-release.outputs.IS_RELEASE
|
||||
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
|
||||
files: |
|
||||
${{ steps.package.outputs.PKG_PATH }}
|
||||
${{ steps.debian-package.outputs.DPKG_PATH }}
|
||||
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
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
+22
-10
@@ -61,9 +61,6 @@
|
||||
[submodule "assets/syntaxes/Puppet"]
|
||||
path = assets/syntaxes/02_Extra/Puppet
|
||||
url = https://github.com/russCloak/SublimePuppet
|
||||
[submodule "assets/syntaxes/CSV"]
|
||||
path = assets/syntaxes/02_Extra/CSV
|
||||
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
|
||||
[submodule "assets/themes/onehalf"]
|
||||
path = assets/themes/onehalf
|
||||
url = https://github.com/sonph/onehalf
|
||||
@@ -97,10 +94,6 @@
|
||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||
[submodule "assets/syntaxes/syslog-syntax"]
|
||||
path = assets/syntaxes/02_Extra/Syslog
|
||||
url = https://github.com/caos21/syslog-syntax.git
|
||||
branch = master
|
||||
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
||||
path = assets/syntaxes/02_Extra/Protobuf
|
||||
url = https://github.com/VcamX/protobuf-syntax-highlighting.git
|
||||
@@ -185,9 +178,6 @@
|
||||
[submodule "assets/syntaxes/02_Extra/AsciiDoc"]
|
||||
path = assets/syntaxes/02_Extra/AsciiDoc
|
||||
url = https://github.com/asciidoctor/sublimetext-asciidoc.git
|
||||
[submodule "assets/themes/gruvbox"]
|
||||
path = assets/themes/gruvbox
|
||||
url = https://github.com/peaceant/gruvbox.git
|
||||
[submodule "assets/syntaxes/02_Extra/GLSL"]
|
||||
path = assets/syntaxes/02_Extra/GLSL
|
||||
url = https://github.com/euler0/sublime-glsl
|
||||
@@ -206,3 +196,25 @@
|
||||
[submodule "assets/themes/Coldark"]
|
||||
path = assets/themes/Coldark
|
||||
url = https://github.com/ArmandPhilippot/coldark-bat.git
|
||||
[submodule "assets/themes/gruvbox"]
|
||||
path = assets/themes/gruvbox
|
||||
url = https://github.com/subnut/gruvbox-tmTheme.git
|
||||
branch = bat-source
|
||||
[submodule "assets/syntaxes/02_Extra/Lean"]
|
||||
path = assets/syntaxes/02_Extra/Lean
|
||||
url = https://github.com/leanprover/vscode-lean.git
|
||||
[submodule "assets/syntaxes/02_Extra/Zig"]
|
||||
path = assets/syntaxes/02_Extra/Zig
|
||||
url = https://github.com/ziglang/sublime-zig-language.git
|
||||
[submodule "assets/syntaxes/02_Extra/gnuplot"]
|
||||
path = assets/syntaxes/02_Extra/gnuplot
|
||||
url = https://github.com/hesstobi/sublime_gnuplot
|
||||
[submodule "assets/syntaxes/02_Extra/SystemVerilog"]
|
||||
path = assets/syntaxes/02_Extra/SystemVerilog
|
||||
url = https://github.com/TheClams/SystemVerilog.git
|
||||
[submodule "assets/themes/visual-studio-dark-plus"]
|
||||
path = assets/themes/visual-studio-dark-plus
|
||||
url = https://github.com/vidann1/visual-studio-dark-plus.git
|
||||
[submodule "assets/syntaxes/02_Extra/SublimeEthereum"]
|
||||
path = assets/syntaxes/02_Extra/SublimeEthereum
|
||||
url = https://github.com/davidhq/SublimeEthereum.git
|
||||
+86
-2
@@ -1,19 +1,103 @@
|
||||
# unreleased
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
## Bugfixes
|
||||
|
||||
|
||||
## Other
|
||||
|
||||
|
||||
## Syntaxes
|
||||
|
||||
|
||||
## New themes
|
||||
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
## Packaging
|
||||
|
||||
|
||||
|
||||
# v0.18.1
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Mouse support and screen clearing broken for `less` versions with minor version number (581.2), see #1629 and #1639 (@aswild)
|
||||
|
||||
## Other
|
||||
|
||||
- `Input::ordinary_file` and `Input::with_name` now accept `Path` rather than `OsStr` see #1571 (@matklad)
|
||||
- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
|
||||
- Increased min. required Rust version to 1.45
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
|
||||
- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
|
||||
- Added SystemVerilog file syntax, see #1580 (@SeanMcLoughlin)
|
||||
- Added Solidity and Vyper syntax, see #1602 (@Ersikan)
|
||||
|
||||
## New themes
|
||||
|
||||
- Dark+ VS Code theme, see #1588 and #1598 (@PatriotRossii)
|
||||
|
||||
|
||||
|
||||
# v0.18.0
|
||||
|
||||
## Features
|
||||
|
||||
- Use a pager when `bat --list-languages` is called, see #1394 (@stku1985)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- If the last line doesn't end with a newline character, don't add it if `--style=plain`, see #1438 (@Enselic)
|
||||
- Only print themes hint in interactive mode (`bat --list-themes`), see #1439 (@rsteube)
|
||||
- Make ./tests/syntax-tests/regression_test.sh work on recent versions of macOS, see #1443 (@Enselic)
|
||||
- VimL syntax highlighting fix, see #1450 (@esensar)
|
||||
- Print an 'Invalid syntax theme settings' error message if a custom theme is broken, see #614 (@Enselic)
|
||||
- If plain mode is set and wrap is not explicitly opted in, long lines will no be truncated, see #1426
|
||||
- If `PAGER` (but not `BAT_PAGER` or `--pager`) is `more` or `most`, silently use `less` instead to ensure support for colors, see #1063 (@Enselic)
|
||||
- If `PAGER` is `bat`, silently use `less` to prevent recursion. For `BAT_PAGER` or `--pager`, exit with error, see #1413 (@Enselic)
|
||||
- Manpage highlighting fix, see #1511 (@keith-hall)
|
||||
- `BAT_CONFIG_PATH` ignored by `bat` if non-existent, see #1550 (@sharkdp)
|
||||
|
||||
## Other
|
||||
|
||||
- Performance improvements, see #1421 (@LovecraftianHorror)
|
||||
- Added a new `--diagnostic` option to collect information for bug reports, see #1459 (@sharkdp)
|
||||
- Modified default theme colors to differentiate between a JSON key and a string value, see #1400 (@keith-hall)
|
||||
- Upped min required Rust version to 1.42
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Added Zig syntax, see #1470 (@paulsmith)
|
||||
- Added Lean syntax, see #1446 (@Julian)
|
||||
- Added `.resource` extension for Robot Framework files, see #1386
|
||||
- Added `gnuplot` syntax, see #1431 (@sharkdp)
|
||||
- Highlight *.pac (Proxy auto-config) files as JavaScript, see #1515 (@sharkdp)
|
||||
|
||||
## New themes
|
||||
|
||||
- `ansi` replaces `ansi-dark` and `ansi-light`, see #1104 and #1412 (@mk12). **Breaking change:** users that were previously using one of the `ansi-*` themes should switch to `ansi`.
|
||||
- The Gruvbox theme has been updated, see #1291 (@j0hnmeow). **Breaking change:** users that were previously using `gruvbox` or `gruvbox-white` should update and use `gruvbox-dark`/`gruvbox-light` instead.
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
- The following `PrettyPrinter` methods have been removed (they were previously deprecated):
|
||||
- `input_stdin_with_name`
|
||||
- `input_from_bytes_with_name`
|
||||
- `input_from_reader_with_name`
|
||||
- `vcs_modification_markers` (if the `git` feature is not enabled)
|
||||
|
||||
|
||||
# v0.17.1
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Running `bat` without arguments fails ("output file is also an input"), see #1396
|
||||
|
||||
|
||||
# v0.17.0
|
||||
|
||||
+2
-2
@@ -8,12 +8,12 @@ Thank you for considering to contribute to `bat`!
|
||||
|
||||
If your contribution changes the behavior of `bat` (as opposed to a typo-fix
|
||||
in the documentation), please update the [`CHANGELOG.md`](CHANGELOG.md) file
|
||||
and describe your changes. This makes the release proess much easier and
|
||||
and describe your changes. This makes the release process much easier and
|
||||
therefore helps to get your changes into a new `bat` release faster.
|
||||
|
||||
The top of the `CHANGELOG` contains a *"unreleased"* section with a few
|
||||
subsections (Features, Bugfixes, …). Please add your entry to the subsection
|
||||
that best describes your change
|
||||
that best describes your change.
|
||||
|
||||
Entries follow this format:
|
||||
```
|
||||
|
||||
Generated
+334
-335
File diff suppressed because it is too large
Load Diff
+19
-15
@@ -1,17 +1,13 @@
|
||||
[package]
|
||||
authors = ["David Peter <mail@david-peter.de>"]
|
||||
categories = ["command-line-utilities"]
|
||||
description="A cat(1) clone with wings."
|
||||
description = "A cat(1) clone with wings."
|
||||
homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.17.0"
|
||||
exclude = [
|
||||
"assets/syntaxes/*",
|
||||
"assets/themes/*",
|
||||
]
|
||||
version = "0.18.1"
|
||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||
build = "build.rs"
|
||||
edition = '2018'
|
||||
|
||||
@@ -22,7 +18,7 @@ default = ["application"]
|
||||
application = [
|
||||
"atty",
|
||||
"clap",
|
||||
"dirs",
|
||||
"dirs-next",
|
||||
"git",
|
||||
"lazy_static",
|
||||
"paging",
|
||||
@@ -31,6 +27,8 @@ application = [
|
||||
]
|
||||
git = ["git2"] # Support indicating git modifications
|
||||
paging = ["shell-words"] # Support applying a pager on the output
|
||||
|
||||
# You need to use one of these if you depend on bat as a library:
|
||||
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
|
||||
regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
|
||||
@@ -38,8 +36,7 @@ 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.13.0"
|
||||
dirs = { version = "3.0", optional = true }
|
||||
console = "0.14.1"
|
||||
lazy_static = { version = "1.4", optional = true }
|
||||
wild = { version = "2.0", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
@@ -51,7 +48,9 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.8"
|
||||
semver = "0.11"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
clircle = "0.1.3"
|
||||
clircle = "0.3"
|
||||
bugreport = "0.4"
|
||||
dirs-next = { version = "2.0.0", optional = true }
|
||||
|
||||
[dependencies.git2]
|
||||
version = "0.13"
|
||||
@@ -59,7 +58,7 @@ optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.syntect]
|
||||
version = "4.4.0"
|
||||
version = "4.5.0"
|
||||
default-features = false
|
||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||
|
||||
@@ -74,9 +73,14 @@ version = "0.12"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
assert_cmd = "1.0.1"
|
||||
predicates = "1.0.5"
|
||||
assert_cmd = "1.0.2"
|
||||
serial_test = "0.5.1"
|
||||
predicates = "1.0.7"
|
||||
wait-timeout = "0.2.0"
|
||||
tempfile = "3.2.0"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
nix = "0.20.0"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "2.33", optional = true }
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 bat-developers (https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -94,6 +94,16 @@ bat f - g # output 'f', then stdin, then 'g'.
|
||||
|
||||
### Integration with other tools
|
||||
|
||||
#### `fzf`
|
||||
|
||||
You can use `bat` as a previewer for [`fzf`](https://github.com/junegunn/fzf). To do this,
|
||||
use `bat`s `--color=always` option to force colorized output. You can also use `--line-range`
|
||||
option to restrict the load times for long files:
|
||||
```bash
|
||||
fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||
```
|
||||
For more information, see [`fzf`s `README`](https://github.com/junegunn/fzf#preview-window).
|
||||
|
||||
#### `find` or `fd`
|
||||
|
||||
You can use the `-exec` option of `find` to preview all search results with `bat`:
|
||||
@@ -163,6 +173,7 @@ bat main.cpp | xclip
|
||||
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
man 2 select
|
||||
```
|
||||
(replace `bat` by `batcat` if you are on Debian or Ubuntu)
|
||||
|
||||
It might also be necessary to set `MANROFFOPT="-c"` if you experience
|
||||
formatting problems.
|
||||
@@ -180,7 +191,7 @@ The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.
|
||||
|
||||
## Installation
|
||||
|
||||
[](https://repology.org/project/bat/versions)
|
||||
[](https://repology.org/project/bat-cat/versions)
|
||||
|
||||
### On Ubuntu (using `apt`)
|
||||
*... and other Debian-based Linux distributions.*
|
||||
@@ -196,7 +207,7 @@ If your Ubuntu/Debian installation is new enough you can simply run:
|
||||
apt install bat
|
||||
```
|
||||
|
||||
If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||
**Important**: If you install `bat` this way, please note that the executable may be installed as `batcat` instead of `bat` (due to [a name
|
||||
clash with another package](https://github.com/sharkdp/bat/issues/982)). You can set up a `bat -> batcat` symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:
|
||||
``` bash
|
||||
mkdir -p ~/.local/bin
|
||||
@@ -211,7 +222,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.17.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -256,6 +267,13 @@ You can install `bat` via xbps-install:
|
||||
xbps-install -S bat
|
||||
```
|
||||
|
||||
### On Termux
|
||||
|
||||
You can install `bat` via pkg:
|
||||
```bash
|
||||
pkg install bat
|
||||
```
|
||||
|
||||
### On FreeBSD
|
||||
|
||||
You can install a precompiled [`bat` package](https://www.freshports.org/textproc/bat) with pkg:
|
||||
@@ -287,6 +305,11 @@ You can install `bat` with zypper:
|
||||
zypper install bat
|
||||
```
|
||||
|
||||
### Via snap package
|
||||
|
||||
There is currently no recommended snap package available.
|
||||
Existing packages may be available, but are not officially supported and may contain [issues](https://github.com/sharkdp/bat/issues/1519).
|
||||
|
||||
### On macOS (or Linux) via Homebrew
|
||||
|
||||
You can install `bat` with [Homebrew on MacOS](https://formulae.brew.sh/formula/bat) or [Homebrew on Linux](https://formulae.brew.sh/formula-linux/bat):
|
||||
@@ -340,7 +363,7 @@ binaries are also available: look for archives with `musl` in the file name.
|
||||
|
||||
### From source
|
||||
|
||||
If you want to build `bat` from source, you need Rust 1.40 or
|
||||
If you want to build `bat` from source, you need Rust 1.45 or
|
||||
higher. You can then use `cargo` to build everything:
|
||||
|
||||
```bash
|
||||
@@ -374,12 +397,11 @@ You can also use a custom theme by following the
|
||||
|
||||
### 8-bit themes
|
||||
|
||||
`bat` has four themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||
`bat` has three themes that always use [8-bit colors](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors),
|
||||
even when truecolor support is available:
|
||||
|
||||
- `ansi-dark` looks decent on any terminal with a dark background. It uses 3-bit colors: black, red,
|
||||
green, yellow, blue, magenta, cyan, and white.
|
||||
- `ansi-light` is like `ansi-dark`, but for terminals with a light background.
|
||||
- `ansi` looks decent on any terminal. It uses 3-bit colors: black, red, green,
|
||||
yellow, blue, magenta, cyan, and white.
|
||||
- `base16` is designed for [base16](https://github.com/chriskempson/base16) terminal themes. It uses
|
||||
4-bit colors (3-bit colors plus bright variants) in accordance with the
|
||||
[base16 styling guidelines](https://github.com/chriskempson/base16/blob/master/styling.md).
|
||||
@@ -466,7 +488,7 @@ You can add new (or change existing) file name patterns using the `--map-syntax`
|
||||
command line option. The option takes an argument of the form `pattern:syntax` where
|
||||
`pattern` is a glob pattern that is matched against the file name and
|
||||
the absolute file path. The `syntax` part is the full name of a supported language
|
||||
(use `bat --list-languages` for an overview)full .
|
||||
(use `bat --list-languages` for an overview).
|
||||
|
||||
Note: You probably want to use this option as an entry in `bat`s configuration file instead
|
||||
of passing it on the command line (see below).
|
||||
@@ -484,7 +506,7 @@ Example: To open all files called `.ignore` (exact match) with the "Git Ignore"
|
||||
Example: To open all `.conf` files in subfolders of `/etc/apache2` with the "Apache Conf"
|
||||
syntax, use (this mapping is already built in):
|
||||
```bash
|
||||
-map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||
--map-syntax='/etc/apache2/**/*.conf:Apache Conf'
|
||||
```
|
||||
|
||||
### Using a different pager
|
||||
@@ -676,6 +698,11 @@ bash assets/create.sh
|
||||
cargo install --path . --locked --force
|
||||
```
|
||||
|
||||
If you want to build an application that uses `bat`s pretty-printing
|
||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
||||
when you depend on `bat` as a library.
|
||||
|
||||
## Contributing
|
||||
|
||||
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||
@@ -685,6 +712,7 @@ Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
||||
- [sharkdp](https://github.com/sharkdp)
|
||||
- [eth-p](https://github.com/eth-p)
|
||||
- [keith-hall](https://github.com/keith-hall)
|
||||
- [Enselic](https://github.com/Enselic)
|
||||
|
||||
## Project goals and alternatives
|
||||
|
||||
@@ -699,7 +727,7 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
||||
[this document](doc/alternatives.md) for a comparison.
|
||||
|
||||
## License
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||
|
||||
|
||||
Vendored
+14
-1
@@ -40,7 +40,7 @@ language names and file extensions.
|
||||
.HP
|
||||
\fB\-H\fR, \fB\-\-highlight\-line\fR <N:M>...
|
||||
.IP
|
||||
Highlight the specified line ranges with a different background color For example:
|
||||
Highlight the specified line ranges with a different background color. For example:
|
||||
.RS
|
||||
.IP "\-\-highlight\-line 40"
|
||||
highlights line 40
|
||||
@@ -52,6 +52,18 @@ highlights lines 1 to 40
|
||||
highlights lines 40 to the end of the file
|
||||
.RE
|
||||
.HP
|
||||
\fB\-\-file\-name\fR <name>...
|
||||
.IP
|
||||
Specify the name to display for a file. Useful when piping data to {{PROJECT_EXECUTABLE}} from STDIN when {{PROJECT_EXECUTABLE}} does not otherwise know the filename. Note that the provided file name is also used for syntax detection.
|
||||
.HP
|
||||
\fB\-d\fR, \fB\-\-diff\fR
|
||||
.IP
|
||||
Only show lines that have been added/removed/modified with respect to the Git index. Use '\-\-diff\-context=N' to control how much context you want to see.
|
||||
.HP
|
||||
\fB\-\-diff\-context\fR <N>...
|
||||
.IP
|
||||
Include N lines of context around added/removed/modified lines when using '\-\-diff'.
|
||||
.HP
|
||||
\fB\-\-tabs\fR <T>
|
||||
.IP
|
||||
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
|
||||
@@ -111,6 +123,7 @@ Map a glob pattern to an existing syntax name. The glob pattern is matched on th
|
||||
path and the filename. For example, to highlight *.build files with the Python syntax,
|
||||
use -m '*.build:Python'. To highlight files named '.myignore' with the Git Ignore
|
||||
syntax, use -m '.myignore:Git Ignore'.
|
||||
Note that the right-hand side is the *name* of the syntax, not a file extension.
|
||||
.HP
|
||||
\fB\-\-theme\fR <theme>
|
||||
.IP
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
diff --git themes/sublime-monokai-extended/Monokai\ Extended.tmTheme themes/sublime-monokai-extended/Monokai\ Extended.tmTheme
|
||||
index 9c2aa3e..180cbbf 100644
|
||||
--- themes/sublime-monokai-extended/Monokai Extended.tmTheme
|
||||
+++ themes/sublime-monokai-extended/Monokai Extended.tmTheme
|
||||
@@ -810,11 +810,11 @@
|
||||
<key>name</key>
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
+ <string>meta.mapping.key.json string.quoted.double.json, punctuation.separator.sequence.csv</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
- <string>#cfcfc2</string>
|
||||
+ <string>#fd971f</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
@@ -1027,7 +1027,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid</string>
|
||||
+ <string>invalid, markup.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid.deprecated</string>
|
||||
+ <string>invalid.deprecated, markup.warning</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/AWK updated: e593eb6d42...e23926eca1
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/CMake updated: 21e96989d6...7d6231c934
Vendored
-1
Submodule assets/syntaxes/02_Extra/CSV deleted from 4786d037a7
+71
-39
@@ -1,46 +1,78 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Advanced CSV
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Comma Separated Values
|
||||
file_extensions:
|
||||
- csv
|
||||
- tsv
|
||||
scope: text.advanced_csv
|
||||
scope: text.csv
|
||||
variables:
|
||||
field_separator: (?:[,;\t])
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
prototype:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
fields:
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
main:
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.quoted.advanced_csv
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
pop: true
|
||||
- include: main
|
||||
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
2: constant.numeric.formula.advanced_csv
|
||||
4: constant.numeric.formula.advanced_csv
|
||||
6: constant.numeric.formula.advanced_csv
|
||||
8: constant.numeric.formula.advanced_csv
|
||||
9: keyword.operator.advanced_csv
|
||||
10: keyword.operator.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.range.advanced_csv
|
||||
- match: (?=(\")|$)
|
||||
pop: true
|
||||
- include: scope:source.python
|
||||
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
|
||||
scope: meta.number.advanced_csv
|
||||
captures:
|
||||
1: constant.numeric.advanced_csv
|
||||
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
|
||||
scope: meta.nonnumber.advanced_csv
|
||||
captures:
|
||||
1: storage.type.advanced_csv
|
||||
- match: (\,)
|
||||
scope: meta.delimiter.advanced_csv
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
- meta_include_prototype: false
|
||||
- match: '^'
|
||||
set: fields
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: double_quoted_string
|
||||
|
||||
- match: (?={{field_separator}}|{{record_separator}})
|
||||
pop: true
|
||||
|
||||
double_quoted_string:
|
||||
- meta_include_prototype: false
|
||||
- meta_scope: string.quoted.double.csv
|
||||
- match: '""'
|
||||
scope: constant.character.escape.csv
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.csv
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv support.type
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Crystal updated: 5e032ff5f5...eb63666f35
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/FSharp updated: c18616d6bd...9e4645c608
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/GraphQL updated: c9d84587eb...59304d6c7b
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Julia updated: 6c0d770fc7...cc13e7d4ef
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/LESS updated: 44632e19af...a2eae0453e
+1
Submodule assets/syntaxes/02_Extra/Lean added at 29a03a8aba
+125
@@ -0,0 +1,125 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Lean
|
||||
file_extensions:
|
||||
- lean
|
||||
scope: source.lean
|
||||
contexts:
|
||||
main:
|
||||
- include: comments
|
||||
- match: '\b(?<!\.)(inductive|coinductive|structure|theorem|axiom|axioms|abbreviation|lemma|definition|def|instance|class|constant)\b\s+(\{[^}]*\})?'
|
||||
captures:
|
||||
1: keyword.other.definitioncommand.lean
|
||||
push:
|
||||
- meta_scope: meta.definitioncommand.lean
|
||||
- match: '(?=\bwith\b|\bextends\b|[:\|\(\[\{⦃<>])'
|
||||
pop: true
|
||||
- include: comments
|
||||
- include: definitionName
|
||||
- match: ","
|
||||
- match: \b(Prop|Type|Sort)\b
|
||||
scope: storage.type.lean
|
||||
- match: '\battribute\b\s*\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: '@\[[^\]]*\]'
|
||||
scope: storage.modifier.lean
|
||||
- match: \b(?<!\.)(private|meta|mutual|protected|noncomputable)\b
|
||||
scope: keyword.control.definition.modifier.lean
|
||||
- match: \b(sorry)\b
|
||||
scope: invalid.illegal.lean
|
||||
- match: '#print\s+(def|definition|inductive|instance|structure|axiom|axioms|class)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: '#(print|eval|reduce|check|help|exit|find|where)\b'
|
||||
scope: keyword.other.command.lean
|
||||
- match: \b(?<!\.)(import|export|prelude|theory|definition|def|abbreviation|instance|renaming|hiding|exposing|parameter|parameters|begin|constant|constants|lemma|variable|variables|theorem|example|open|axiom|inductive|coinductive|with|structure|universe|universes|alias|precedence|reserve|postfix|prefix|infix|infixl|infixr|notation|end|using|namespace|section|local|set_option|extends|include|omit|class|classes|instances|raw|run_cmd|restate_axiom)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: \b(?<!\.)(calc|have|this|match|do|suffices|show|by|in|at|let|forall|fun|exists|assume|from|obtain|haveI|λ)(?!\.)\b
|
||||
scope: keyword.other.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.lean
|
||||
- match: »
|
||||
pop: true
|
||||
- match: \b(?<!\.)(if|then|else)\b
|
||||
scope: keyword.control.lean
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.lean
|
||||
push:
|
||||
- meta_scope: string.quoted.double.lean
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.lean
|
||||
pop: true
|
||||
- match: '\\[\\"nt'']'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\x[0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '\\u[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]'
|
||||
scope: constant.character.escape.lean
|
||||
- match: '''[^\\'']'''
|
||||
scope: string.quoted.single.lean
|
||||
- match: '''(\\(x..|u....|.))'''
|
||||
scope: string.quoted.single.lean
|
||||
captures:
|
||||
1: constant.character.escape.lean
|
||||
- match: '`+[^\[(]\S+'
|
||||
scope: entity.name.lean
|
||||
- match: '\b([0-9]+|0([xX][0-9a-fA-F]+))\b'
|
||||
scope: constant.numeric.lean
|
||||
blockComment:
|
||||
- match: /-
|
||||
push:
|
||||
- meta_scope: comment.block.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
comments:
|
||||
- include: dashComment
|
||||
- include: docComment
|
||||
- include: stringBlock
|
||||
- include: modDocComment
|
||||
- include: blockComment
|
||||
dashComment:
|
||||
- match: (--)
|
||||
captures:
|
||||
0: punctuation.definition.comment.lean
|
||||
push:
|
||||
- meta_scope: comment.line.double-dash.lean
|
||||
- match: $
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
definitionName:
|
||||
- match: '\b[^:«»\(\)\{\}[:space:]=→λ∀?][^:«»\(\)\{\}[:space:]]*'
|
||||
scope: entity.name.function.lean
|
||||
- match: «
|
||||
push:
|
||||
- meta_content_scope: entity.name.function.lean
|
||||
- match: »
|
||||
pop: true
|
||||
docComment:
|
||||
- match: /--
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
modDocComment:
|
||||
- match: /-!
|
||||
push:
|
||||
- meta_scope: comment.block.documentation.lean
|
||||
- match: "-/"
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
stringBlock:
|
||||
- match: /-"
|
||||
push:
|
||||
- meta_scope: comment.block.string.lean
|
||||
- match: '"-/'
|
||||
pop: true
|
||||
- include: scope:source.lean.markdown
|
||||
- include: blockComment
|
||||
+12
-4
@@ -59,12 +59,19 @@ contexts:
|
||||
escape: '(?={{section_heading}})'
|
||||
|
||||
function-call:
|
||||
- match: '\b([A-Za-z0-9_\-]+)(\()([^)]*)(\))'
|
||||
- match: '\b([A-Za-z0-9_\-]+\.)?([A-Za-z0-9_\-]+)(\()([^)]*)(\))'
|
||||
captures:
|
||||
1: entity.name.function.man
|
||||
2: keyword.operator.man
|
||||
3: constant.numeric.man
|
||||
4: keyword.operator.man
|
||||
2: entity.name.function.man
|
||||
3: keyword.operator.man
|
||||
4: constant.numeric.man
|
||||
5: keyword.operator.man
|
||||
|
||||
env-var:
|
||||
- match: '(\$)(?!\d)(\w+)\b'
|
||||
captures:
|
||||
1: punctuation.definition.variable.man
|
||||
2: constant.other.man
|
||||
|
||||
options:
|
||||
# command-line options like --option=value, --some-flag, or -x
|
||||
@@ -86,6 +93,7 @@ contexts:
|
||||
pop: true
|
||||
- include: function-call
|
||||
- include: c-code
|
||||
- include: env-var
|
||||
|
||||
expect-command-line-option:
|
||||
- match: '[A-Za-z0-9-]+'
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
name: Robot Framework
|
||||
file_extensions:
|
||||
- robot
|
||||
- resource
|
||||
scope: source.robot
|
||||
contexts:
|
||||
main:
|
||||
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: bc6332c1be...63819a1ab6
+1
Submodule assets/syntaxes/02_Extra/SublimeEthereum added at b60e0a3e00
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Svelte updated: bf92f5b7b6...c71f1290b0
Vendored
-1
Submodule assets/syntaxes/02_Extra/Syslog deleted from 7628d4e0b8
+1
Submodule assets/syntaxes/02_Extra/SystemVerilog added at 7eca705e87
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/TypeScript updated: 603ebb48b1...a607ddfec9
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/VimL updated: ed40c3bc81...7ebcaa1d98
-91
@@ -1,91 +0,0 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: VimL
|
||||
file_extensions:
|
||||
- vim
|
||||
- .vimrc
|
||||
scope: source.viml
|
||||
contexts:
|
||||
main:
|
||||
- include: comment
|
||||
- include: string_quoted_double
|
||||
- include: string_quoted_single
|
||||
- include: string_regex
|
||||
- include: inline_comment
|
||||
- include: number_int
|
||||
- include: number_hex
|
||||
- include: keyword
|
||||
- include: support_function
|
||||
- include: support_variable
|
||||
- include: support_type
|
||||
- include: function_params
|
||||
- include: function_definition
|
||||
- include: function_call
|
||||
- include: function
|
||||
- include: variable
|
||||
- include: expr
|
||||
comment:
|
||||
- match: ^\s*".*$
|
||||
scope: comment.line.quotes.viml
|
||||
captures:
|
||||
1: punctuation.definition.comment.vim
|
||||
expr:
|
||||
- match: (\|\||&&|==(\?|#)?|(!|>|<)=(#|\?)?|(=|!)~(#|\?)?|(>|<)(#|\?)is|isnot|\.|\*|\\|%)
|
||||
scope: storage.function.viml
|
||||
function:
|
||||
- match: \b(fu(n|nction)?|end(f|fu|fun|function)?)\b
|
||||
scope: storage.function.viml
|
||||
function_call:
|
||||
- match: '(([sgbwtl]|)?:?[0-9a-zA-Z_#]+)(?=\()'
|
||||
scope: support.function.any-method
|
||||
function_definition:
|
||||
- match: '^\s*(function)\s*!?\s+(?=(s:)?[0-9a-zA-Z_#]+\s*\()'
|
||||
captures:
|
||||
1: storage.function.viml
|
||||
push:
|
||||
- meta_scope: meta.function.viml
|
||||
- match: (\()
|
||||
captures:
|
||||
1: punctuation.definition.parameters.begin.viml
|
||||
pop: true
|
||||
- match: "(s:)?[0-9a-zA-Z_#]+"
|
||||
scope: entity.name.function.viml
|
||||
function_params:
|
||||
- match: '-\w+='
|
||||
scope: support.type.viml
|
||||
inline_comment:
|
||||
- match: '(?!\$)(")(?!\{).*$\n?'
|
||||
scope: comment.line.quotes.viml
|
||||
captures:
|
||||
1: punctuation.definition.comment.vim
|
||||
keyword:
|
||||
- match: \b(if|while|for|try|return|throw|end(if|for|while|try)?|au(g|group)|else(if|)?|do|in|catch|finally|:)\b
|
||||
scope: keyword.control.viml
|
||||
number_hex:
|
||||
- match: "0x[0-9a-f]+"
|
||||
scope: constant.numeric.hex
|
||||
number_int:
|
||||
- match: '-?\d+'
|
||||
scope: constant.numeric.integer
|
||||
string_quoted_double:
|
||||
- match: '"(\\\\|\\"|\n[^\S\n]*\\|[^\n"])*"'
|
||||
scope: string.quoted.double.viml
|
||||
string_quoted_single:
|
||||
- match: '''(''''|\n[^\S\n]*\\|[^\n''])*'''
|
||||
scope: string.quoted.single.viml
|
||||
string_regex:
|
||||
- match: '/(\\\\|\\/|\n[^\S\n]*\\|[^\n/])*/'
|
||||
scope: string.regexp.viml
|
||||
support_function:
|
||||
- match: \b(set(local|global)?|let|command|filetype|colorscheme|\w*map|\w*a(b|brev)?|syn|exe(c|cute)?|ec(ho|)?|au(tocmd|)?)\b
|
||||
scope: support.function.viml
|
||||
support_type:
|
||||
- match: <.*?>
|
||||
scope: support.type.viml
|
||||
support_variable:
|
||||
- match: '\b(am(enu|)?|(hl|inc)?search|[Bb]uf([Nn]ew[Ff]ile|[Rr]ead)?|[Ff]ile[Tt]ype)\b'
|
||||
scope: support.variable.viml
|
||||
variable:
|
||||
- match: '([sSgGbBwWlLaAvV]:|@|$|&(?!&))\w*'
|
||||
scope: variable.other.viml
|
||||
+1
Submodule assets/syntaxes/02_Extra/Zig added at 87ecbcae6f
+1
Submodule assets/syntaxes/02_Extra/gnuplot added at 04743470ff
+182
@@ -0,0 +1,182 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: gnuplot
|
||||
file_extensions:
|
||||
- gp
|
||||
- gpl
|
||||
- gnuplot
|
||||
- gnu
|
||||
- plot
|
||||
- plt
|
||||
scope: source.gnuplot
|
||||
contexts:
|
||||
main:
|
||||
- include: number
|
||||
- include: string_single
|
||||
- include: string_double
|
||||
- match: '\b(for)\b\s*(\[)'
|
||||
comment: |
|
||||
gnuplot iteration statement.
|
||||
There are two forms:
|
||||
numeric [n = 1:2{:inc}]
|
||||
string based [str in "x y z"]
|
||||
but both can also iterate over lists etc, so this is kept loose.
|
||||
captures:
|
||||
1: keyword.other.iteration.gnuplot
|
||||
2: punctuation.definition.range.begin.gnuplot
|
||||
push:
|
||||
- meta_scope: meta.structure.iteration.gnuplot
|
||||
- match: '\]'
|
||||
captures:
|
||||
0: punctuation.definition.range.end.gnuplot
|
||||
pop: true
|
||||
- include: number
|
||||
- include: operator
|
||||
- include: string_double
|
||||
- include: string_single
|
||||
- match: ":"
|
||||
scope: punctuation.separator.range.gnuplot
|
||||
- match: '\b([a-zA-Z]\w*)\b\s*(=|in)'
|
||||
scope: variable-assignment.range.gnuplot
|
||||
- match: '(?i:[^\s(pi|e)\]])'
|
||||
scope: invalid.illegal.expected-range-separator.gnuplot
|
||||
- match: '\['
|
||||
comment: "gnuplot range statement [a:b]. Lots of things are legal, still more make no sense!"
|
||||
captures:
|
||||
0: punctuation.definition.range.begin.gnuplot
|
||||
push:
|
||||
- meta_scope: meta.structure.range.gnuplot
|
||||
- match: '\]'
|
||||
captures:
|
||||
0: punctuation.definition.range.end.gnuplot
|
||||
pop: true
|
||||
- include: number
|
||||
- include: operator
|
||||
- match: ":"
|
||||
scope: punctuation.separator.range.gnuplot
|
||||
- match: '(?i:[^\s(pi|e)\]])'
|
||||
scope: invalid.illegal.expected-range-separator.gnuplot
|
||||
- match: \\.
|
||||
scope: constant.character.escape.gnuplot
|
||||
- match: '(?<!\$)(#)(?!\{).*$\n?'
|
||||
scope: comment.line.number-sign.gnuplot
|
||||
captures:
|
||||
1: punctuation.definition.comment.gnuplot
|
||||
- match: for
|
||||
comment: introduce in gnuplot 4.3.
|
||||
scope: keyword.other.iteration.gnuplot
|
||||
- match: \b(angles|arrow|autoscale|bars|border|boxwidth|clabel|clip|cntrparam|colorbox|contour|decimalsign|dgrid3d|dummy|encoding|fit|format|grid|hidden3d|historysize|isosamples|key|label|locale|logscale|macros|bmargin|lmargin|rmargin|tmargin|mapping|mouse|multiplot|offsets|origin|output|palette|parametric|pm3d|pointsize|polar|print|rrange|trange|urange|vrange|samples|size|style|surface|tics|ticscale|ticslevel|timestamp|timefmt|title|view|xyplane|x2data|xdata|y2data|ydata|z2data|zdata|x2label|xlabel|y2label|ylabel|z2label|zlabel|x2range|xrange|y2range|yrange|z2range|zrange|mx2tics|mxtics|my2tics|mytics|mz2tics|mztics|nomx2tics|nomxtics|nomy2tics|nomytics|nomz2tics|nomztics|nox2tics|noxtics|noy2tics|noytics|noz2tics|noztics|x2tics|xtics|y2tics|ytics|z2tics|ztics|x2dtics|x2mtics|xdtics|xmtics|y2dtics|y2mtics|ydtics|ymtics|z2dtics|z2mtics|zdtics|zmtics|x2zeroaxis|xzeroaxis|y2zeroaxis|yzeroaxis|z2zeroaxis|zeroaxis|zzeroaxis|zero|)\b
|
||||
scope: keyword.other.setting.gnuplot
|
||||
- match: \b(cd|call|clear|exit|plot|splot|help|load|pause|quit|fit|replot|if|FIT_LIMIT|FIT_MAXITER|FIT_START_LAMBDA|FIT_LAMBDA_FACTOR|FIT_LOG|FIT_SCRIPT|print|pwd|reread|reset|save|show|test|!|functions|var)\b
|
||||
comment: missuse of scopes alert! Just for pretty colours
|
||||
scope: keyword.other.command.gnuplot
|
||||
- match: \b(abs|acos|acosh|arg|asin|asinh|atan|atan2|atanh|besj0|besj1|besy0|besy1|ceil|cos|cosh|erf|erfc|exp|floor|gamma|ibeta|igamma|imag|int|inverf|invnorm|lambertw|lgamma|log|log10|norm|rand|real|sgn|sin|sinh|sqrt|tan|tanh)\b
|
||||
scope: support.function.gnuplot
|
||||
- match: \b(gprintf|sprintf|strlen|strstrt|substr|system|word|words)\b
|
||||
scope: support.function.string.gnuplot
|
||||
- match: \b(on|off|default|inside|outside|lmargin|rmargin|tmargin|bmargin|at|left|right|center|top|bottom|center|vertical|horizontal|Left|Right|noreverse|noinvert|samplen|spacing|width|height|noautotitle|columnheader|title|noenhanced|nobox|linestyle|ls|linetype|lt|linewidth|lw)\b
|
||||
scope: constant.other.type.gnuplot
|
||||
- match: \b(aed512|aed767|aifm|aqua|bitgraph|cgm|corel|dumb|dxf|eepic|emf|emtex|epslatex|epson_180dpi|epson_60dpi|epson_lx800|fig|gif|gpic|hp2623A|hp2648|hp500c|hpdj|hpgl|hpljii|hppj|imagen|jpeg|kc_tek40xx|km_tek40xx|latex|mf|mif|mp|nec_cp6|okidata|pbm|pcl5|pdf|png|postscript|pslatex|pstex|pstricks|qms|regis|selanar|starc|svg|tandy_60dpi|tek40xx|tek410x|texdraw|tgif|tkcanvas|tpic|unknown|vttek)\b
|
||||
scope: constant.other.terminal.gnuplot
|
||||
- match: \b(u(sing)?|t(it(le)?)?|notit(le)?|w(i(th)?)?|steps|fs(teps)?|notitle|l(i(nes)?)?|linespoints|via)\b
|
||||
scope: keyword.modifier.gnuplot
|
||||
- match: |-
|
||||
(?x:
|
||||
\b # Start with a word boundary
|
||||
(?=\b[\w$]*(\(|.*=)) # Look-ahead for a bracket or equals
|
||||
(?![^(]*\)) # negative look ahead for a closing bracket without an opening one. This stops a from matching in f(a)
|
||||
( # Group variable name
|
||||
[A-Za-z] # A letter
|
||||
[\w$]* # Any word chars or $
|
||||
) # That is it for the name.
|
||||
)
|
||||
comment: user defined function / variable
|
||||
scope: variable.other.gnuplot
|
||||
- match: \b(if)\b
|
||||
scope: keyword.control.gnuplot
|
||||
- match: \b(show)\b
|
||||
captures:
|
||||
0: keyword.other.command.gnuplot
|
||||
push:
|
||||
- meta_scope: keyword.line.show.gnuplot
|
||||
- meta_content_scope: keyword.line.show.gnuplot
|
||||
- match: (?!\#)($\n?)
|
||||
pop: true
|
||||
- include: main
|
||||
- match: \b(set)\b\s*\b(terminal|term)\b
|
||||
captures:
|
||||
1: keyword.other.command.gnuplot
|
||||
2: keyword.other.setting.gnuplot
|
||||
push:
|
||||
- meta_scope: keyword.line.set.terminal.gnuplot
|
||||
- match: (?!\#)($\n?)
|
||||
pop: true
|
||||
- include: main
|
||||
- match: \b(set)\b\s*\b(key)\b
|
||||
captures:
|
||||
1: keyword.other.command.gnuplot
|
||||
2: keyword.other.setting.gnuplot
|
||||
push:
|
||||
- meta_scope: keyword.line.set.key.gnuplot
|
||||
- match: (?!\#)($\n?)
|
||||
pop: true
|
||||
- include: main
|
||||
- match: \b(set|unset)\b\s*(?!\b(terminal|key|for)\b)
|
||||
captures:
|
||||
1: keyword.other.command.gnuplot
|
||||
2: keyword.other.setting.gnuplot
|
||||
push:
|
||||
- meta_scope: keyword.line.set.gnuplot
|
||||
- meta_content_scope: keyword.line.set.gnuplot
|
||||
- match: (?!\#)($\n?)
|
||||
pop: true
|
||||
- include: main
|
||||
number:
|
||||
- match: |-
|
||||
(?x: # turn on extended mode
|
||||
-? # an optional minus
|
||||
(?:
|
||||
0 # a zero
|
||||
| # ...or...
|
||||
[1-9] # a 1-9 character
|
||||
\d* # followed by zero or more digits
|
||||
)
|
||||
(?:
|
||||
\. # a period
|
||||
\d+ # followed by one or more digits
|
||||
(?:
|
||||
[eE] # an e character
|
||||
[+-]? # followed by an option +/-
|
||||
\d+ # followed by one or more digits
|
||||
)? # make exponent optional
|
||||
)? # make decimal portion optional
|
||||
)
|
||||
comment: borrowed from textmate book
|
||||
scope: constant.numeric.gnuplot
|
||||
operator:
|
||||
- match: \s*(==|~=|>|>=|<|<=|&|&&|:|\||\|\||\+|-|\*|\.\*|/|\./|\\|\.\\|\^|\.\^)\s*
|
||||
comment: Operator symbols
|
||||
scope: keyword.operator.symbols.matlab
|
||||
string_double:
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.gnuplot
|
||||
push:
|
||||
- meta_scope: string.quoted.double.gnuplot
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.gnuplot
|
||||
pop: true
|
||||
- match: '\\[\$`"\\\n]'
|
||||
scope: constant.character.escape.gnuplot
|
||||
string_single:
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.gnuplot
|
||||
push:
|
||||
- meta_scope: string.quoted.single.gnuplot
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.end.gnuplot
|
||||
pop: true
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
file_extensions:
|
||||
- log
|
||||
scope: text.log
|
||||
variables:
|
||||
ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
|
||||
contexts:
|
||||
main:
|
||||
- match: (\w+)(=)
|
||||
captures:
|
||||
1: variable.parameter.log
|
||||
2: keyword.operator.assignment.log
|
||||
- match: (')([^']*)(')
|
||||
scope: string.quoted.single.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- match: (")([^"]*)(")
|
||||
scope: string.quoted.double.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- include: dates
|
||||
- include: ip_addresses
|
||||
- include: numbers
|
||||
- match: \b(?i:fail(?:ure|ed)?|error|exception)\b
|
||||
scope: markup.error.log
|
||||
- match: \b(?i:warn(?:ing)?)\b
|
||||
scope: markup.warning.log
|
||||
#- include: scope:text.html.markdown#autolink-inet
|
||||
- match: \b\w+:/{2,3}
|
||||
scope: markup.underline.link.scheme.log
|
||||
push: url-host
|
||||
dates:
|
||||
- match: \b\d{4}-\d{2}-\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b\d{4}/\d{2}/\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
|
||||
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
ip_addresses:
|
||||
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v4.log meta.number.integer.decimal.log
|
||||
- match: \d+
|
||||
scope: constant.numeric.value.log
|
||||
- match: \.
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
- match: (?=(?:\h{0,4}:){2,6}\h{1,4}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v6.log meta.number.integer.hexadecimal.log
|
||||
- match: \h{1,4}
|
||||
scope: constant.numeric.value.log
|
||||
- match: ':'
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
numbers:
|
||||
- match: \b(0x)(\h+)(?:(\.)(\h+))?\b
|
||||
scope: meta.number.float.hexadecimal.log
|
||||
captures:
|
||||
1: constant.numeric.base.log
|
||||
2: constant.numeric.value.log
|
||||
3: constant.numeric.value.log punctuation.separator.decimal.log
|
||||
4: constant.numeric.value.log
|
||||
- match: \b\d+(\.)\d+\b
|
||||
scope: meta.number.float.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
- match: \b\d+\b
|
||||
scope: meta.number.integer.log constant.numeric.value.log
|
||||
url-host:
|
||||
- meta_content_scope: markup.underline.link.host.log
|
||||
- match: \[
|
||||
scope: punctuation.section.brackets.begin.log
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.brackets.end.log
|
||||
pop: true
|
||||
- include: ip_addresses
|
||||
- match: '[^:/\s]+'
|
||||
- match: ''
|
||||
set: url-after-host
|
||||
url-after-host:
|
||||
- match: (:)(\d+)
|
||||
scope: markup.underline.link.port.log
|
||||
captures:
|
||||
1: punctuation.separator.mapping.port.log
|
||||
2: constant.numeric.value.log
|
||||
#- include: scope:text.html.markdown#url-escaped-chars
|
||||
- match: (%)\h{2}
|
||||
scope: markup.underline.link.path.log constant.character.escape.url.log
|
||||
captures:
|
||||
1: punctuation.definition.escape.log
|
||||
# After a valid domain, zero or more non-space non-< characters may follow
|
||||
- match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link
|
||||
pop: true
|
||||
- match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis
|
||||
push:
|
||||
- meta_scope: markup.underline.link.path.log
|
||||
- match: (?=[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: \)
|
||||
pop: true
|
||||
- match: (?=\)[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: '[^?!.,:*_~\s<&()%]+|\S'
|
||||
scope: markup.underline.link.path.log
|
||||
- match: ''
|
||||
pop: true
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/ssh-config updated: 1ddcb320ac...201816b609
+60
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename,Surname,House No.,Street,City,Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John,Doe,87,Logon Road,Citiville,TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane,Doe,22,"""Fun"" Street","The City, County",FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred,Bloggs,"19","Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines",Citee,P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
+11
@@ -149,3 +149,14 @@ EXAMPLE
|
||||
#define POLLIN_SET (EPOLLRDNORM | EPOLLRDBAND | EPOLLIN |
|
||||
EPOLLHUP | EPOLLERR)
|
||||
# ^ source.c meta.preprocessor.macro meta.group punctuation.section.group.end
|
||||
|
||||
ENVIRONMENT
|
||||
$SYSTEMD_LOG_LEVEL
|
||||
# ^ punctuation.definition.variable
|
||||
# ^^^^^^^^^^^^^^^^^ constant.other
|
||||
systemd reads the log level from this environment variable. This
|
||||
can be overridden with --log-level=.
|
||||
|
||||
SEE ALSO
|
||||
The systemd Homepage[11], systemd-system.conf(5), locale.conf(5)
|
||||
# ^^^^^^^^^^^^^^^^^^^ entity.name.function
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename Surname House No. Street City Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John Doe 87 Logon Road Citiville TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane Doe 22 """Fun"" Street" "The City County" FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred Bloggs "19" "Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines" Citee P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
+63
@@ -0,0 +1,63 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: syslog
|
||||
file_extensions:
|
||||
- syslog
|
||||
scope: text.log.syslog
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
|
||||
scope: meta.datetime.syslog constant.numeric.syslog
|
||||
captures:
|
||||
1: meta.date.syslog
|
||||
2: meta.time.syslog
|
||||
push: loghost
|
||||
- match: ^
|
||||
push: text
|
||||
loghost:
|
||||
- match: '[\w-]+'
|
||||
scope: entity.other.attribute-name.loghost.syslog
|
||||
set: process
|
||||
process:
|
||||
- match: ([\w-]+)(?:(\[)(\d+)(\]))?(:)
|
||||
captures:
|
||||
1: support.function.process.syslog
|
||||
2: punctuation.separator.pid.begin.syslog
|
||||
3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
|
||||
4: punctuation.separator.pid.end.syslog
|
||||
5: punctuation.separator.mapping.syslog
|
||||
set: structured-data
|
||||
structured-data:
|
||||
- match: '\['
|
||||
scope: punctuation.section.mapping.begin.syslog
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.mapping.end.syslog
|
||||
pop: true
|
||||
- match: \w+
|
||||
scope: variable.parameter.syslog
|
||||
- match: =
|
||||
scope: keyword.operator.assignment.syslog
|
||||
push:
|
||||
- match: '[^\s\]]+'
|
||||
scope: constant.other.syslog
|
||||
pop: true
|
||||
- match: (?=\])
|
||||
pop: true
|
||||
- match: (?=\S)
|
||||
set: text
|
||||
text:
|
||||
- match: $
|
||||
pop: true
|
||||
- match: '<\w+>'
|
||||
scope: constant.language.syslog
|
||||
- match: \b(CMD)\b\s+(\()
|
||||
captures:
|
||||
1: entity.name.label.syslog
|
||||
2: punctuation.section.block.begin.syslog
|
||||
embed: scope:source.shell.bash
|
||||
escape: \)$
|
||||
escape_captures:
|
||||
0: punctuation.section.block.end.syslog
|
||||
- include: scope:text.log
|
||||
Vendored
BIN
Binary file not shown.
Vendored
+1
-1
Submodule assets/themes/Coldark updated: b4a1c74d8d...e44750b2a9
Vendored
-504
@@ -1,504 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||
that this encoding is being used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
<key>name</key>
|
||||
<string>ANSI Light</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#07000000</string>
|
||||
<key>caret</key>
|
||||
<string>#00000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
<key>invisibles</key>
|
||||
<string>#00000000</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#00000000</string>
|
||||
<key>selection</key>
|
||||
<string>#00000000</string>
|
||||
<key>gutter</key>
|
||||
<string>#07000000</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Text</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comments</string>
|
||||
<key>scope</key>
|
||||
<string>comment, punctuation.definition.comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Delimiters</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Operators</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keywords</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variables</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Functions</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function, meta.require, support.function.any-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Labels</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.label</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>support.class, entity.name.class, entity.name.type.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>meta.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Methods</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.special-method</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Support</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Strings, Inherited Class</string>
|
||||
<key>scope</key>
|
||||
<string>string, constant.other.symbol, entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Integers</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Floats</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Boolean</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Constants</string>
|
||||
<key>scope</key>
|
||||
<string>constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tags</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attributes</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Attribute IDs</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Selector</string>
|
||||
<key>scope</key>
|
||||
<string>meta.selector</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Values</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Headings</string>
|
||||
<key>scope</key>
|
||||
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string></string>
|
||||
<key>foreground</key>
|
||||
<string>#04000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Units</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.other.unit</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Bold</string>
|
||||
<key>scope</key>
|
||||
<string>markup.bold, punctuation.definition.bold</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>bold</string>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Italic</string>
|
||||
<key>scope</key>
|
||||
<string>markup.italic, punctuation.definition.italic</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Code</string>
|
||||
<key>scope</key>
|
||||
<string>markup.raw.inline</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Text</string>
|
||||
<key>scope</key>
|
||||
<string>string.other.link, punctuation.definition.string.end.markdown, punctuation.definition.string.begin.markdown</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Link Url</string>
|
||||
<key>scope</key>
|
||||
<string>meta.link</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Quotes</string>
|
||||
<key>scope</key>
|
||||
<string>markup.quote</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inserted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.inserted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Deleted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.deleted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#01000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Changed</string>
|
||||
<key>scope</key>
|
||||
<string>markup.changed</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Colors</string>
|
||||
<key>scope</key>
|
||||
<string>constant.other.color</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Regular Expressions</string>
|
||||
<key>scope</key>
|
||||
<string>string.regexp</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Escape Characters</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character.escape</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#06000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Embedded</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.section.embedded, variable.interpolation</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Illegal</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.illegal</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#01000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Broken</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.broken</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#03000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>uuid</key>
|
||||
<string>uuid</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+12
-86
@@ -3,14 +3,14 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!--
|
||||
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||
that this encoding is being used.
|
||||
The colors in this theme are encoded as #RRGGBBAA where:
|
||||
* If AA is 00, then RR is an ANSI palette number from 00 to 07.
|
||||
* If AA is 01, the terminal's default fg/bg color is used.
|
||||
-->
|
||||
<key>author</key>
|
||||
<string>Template: Chris Kempson, Scheme: Mitchell Kember</string>
|
||||
<key>name</key>
|
||||
<string>ANSI Dark</string>
|
||||
<string>ANSI</string>
|
||||
<key>colorSpaceName</key>
|
||||
<string>sRGB</string>
|
||||
<key>settings</key>
|
||||
@@ -19,32 +19,17 @@
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#00000000</string>
|
||||
<key>caret</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
<key>invisibles</key>
|
||||
<string>#07000000</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#07000000</string>
|
||||
<key>selection</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
<!--
|
||||
Explicitly set the gutter color since bat falls back to a
|
||||
hardcoded DEFAULT_GUTTER_COLOR otherwise.
|
||||
-->
|
||||
<key>gutter</key>
|
||||
<string>#00000000</string>
|
||||
<string>#00000001</string>
|
||||
<key>gutterForeground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Text</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
<string>#00000001</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
@@ -58,39 +43,6 @@
|
||||
<string>#02000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Punctuation</string>
|
||||
<key>scope</key>
|
||||
<string>punctuation.definition.string, punctuation.definition.variable, punctuation.definition.string, punctuation.definition.parameters, punctuation.definition.string, punctuation.definition.array</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Delimiters</string>
|
||||
<key>scope</key>
|
||||
<string>none</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Operators</string>
|
||||
<key>scope</key>
|
||||
<string>keyword.operator</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keywords</string>
|
||||
@@ -102,17 +54,6 @@
|
||||
<string>#05000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variables</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Functions</string>
|
||||
@@ -146,17 +87,6 @@
|
||||
<string>#03000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Classes</string>
|
||||
<key>scope</key>
|
||||
<string>meta.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Methods</string>
|
||||
@@ -480,8 +410,6 @@
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#01000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#07000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
@@ -493,8 +421,6 @@
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#03000000</string>
|
||||
<key>foreground</key>
|
||||
<string>#00000000</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
Vendored
+1
-1
Submodule assets/themes/dracula-sublime updated: 26c57ec282...c2de0acf5a
Vendored
+1
-1
Submodule assets/themes/gruvbox updated: e3db74d0e5...64c47250e5
Vendored
+1
-1
Submodule assets/themes/onehalf updated: 89923117bc...141c775ace
+1
Submodule assets/themes/visual-studio-dark-plus added at 01ee1e8e0d
Vendored
+1
-1
Submodule assets/themes/zenburn updated: cb746f6962...702023d80d
Vendored
+6
-4
@@ -58,7 +58,8 @@ _bat_:run() {
|
||||
_out "$BAT" --version
|
||||
_out env | grep '^BAT_\|^PAGER='
|
||||
|
||||
local cache_dir="$($BAT --cache-dir)"
|
||||
local cache_dir
|
||||
cache_dir="$($BAT --cache-dir)"
|
||||
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
||||
_print_command "$BAT" "--list-languages"
|
||||
echo "Found custom syntax set."
|
||||
@@ -79,8 +80,8 @@ _bat_config_:run() {
|
||||
_bat_wrapper_:run() {
|
||||
_bat_wrapper_:detect_wrapper() {
|
||||
local bat="$1"
|
||||
if file "$(which "${bat}")" | grep "text executable" &> /dev/null; then
|
||||
_out_fence cat "$(which "${bat}")"
|
||||
if file "$(command -v "${bat}")" | grep "text executable" &> /dev/null; then
|
||||
_out_fence cat "$(command -v "${bat}")"
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -104,7 +105,8 @@ _bat_wrapper_function_:run() {
|
||||
fi ;;
|
||||
|
||||
*bash* | *zsh*)
|
||||
local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||
local type
|
||||
type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||
if grep 'function' <<< "$type" &> /dev/null; then
|
||||
_out_fence "$SHELL" --login -i -c "declare -f ${command}"
|
||||
return
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||
次の方法でインストールします:
|
||||
```bash
|
||||
sudo dpkg -i bat_0.17.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -630,7 +630,7 @@ cargo install --locked --force
|
||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||
|
||||
## ライセンス
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
|
||||
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ apt install bat
|
||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.17.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -553,7 +553,7 @@ cargo install --locked --force
|
||||
비슷한 프로그램들을 찾고 있다면, 많은 대안들이 있습니다. 비교는 [이 문서]((doc/alternatives.md))를 참조해주세요.
|
||||
|
||||
## 라이센스
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat`는 MIT 라이센스 및 Apache 라이센스 2.0의 조건에 따라 배포됩니다.
|
||||
|
||||
|
||||
+3
-3
@@ -185,7 +185,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.17.0_amd64.deb # измените архитектуру и версию
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # измените архитектуру и версию
|
||||
```
|
||||
|
||||
### Alpine Linux
|
||||
@@ -341,7 +341,7 @@ ansible-galaxy install aeimer.install_bat
|
||||
|
||||
### Из исходников
|
||||
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.40 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.45 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
@@ -587,7 +587,7 @@ cargo install --locked --force
|
||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||
|
||||
## Лицензия
|
||||
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ if you are not looking for a program like `bat`, this comparison might not be fo
|
||||
| Drop-in `cat` replacement | :heavy_check_mark: [*](https://github.com/sharkdp/bat/issues/134) | :x: | :x: | (:heavy_check_mark:) | :x: | :x: [*](https://github.com/rstacruz/hicat/issues/6) | :x: | :x: |
|
||||
| Git integration | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
|
||||
| Automatic paging | :heavy_check_mark: | :x: | :x: | :x: | :x: | :heavy_check_mark: | :x: | :x: |
|
||||
| Languages (circa) | 110 | 300 | 200 | 7 | 80 | 130 | 30 | 130 |
|
||||
| Languages (circa) | 150 | 300 | 200 | 7 | 80 | 130 | 30 | 130 |
|
||||
| Extensible (languages, themes) | :heavy_check_mark: | (:heavy_check_mark:) | (:heavy_check_mark:) | :x: | (:heavy_check_mark:) | :x: | :x: | :x: |
|
||||
| Advanced highlighting (e.g. nested syntaxes) | :heavy_check_mark: | :heavy_check_mark: | (:heavy_check_mark:) ? | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
|
||||
| Execution time [ms] (`jquery-3.3.1.js`) | 624 | 789 | 400 | 80 | 300 | 316 | 157 | 695 |
|
||||
|
||||
+39
-3
@@ -16,16 +16,51 @@ in the `.sublime-syntax` format.
|
||||
*New Syntax from XXX.tmLanguage...*. Save the new file in the `assets/syntaxes` folder.
|
||||
|
||||
3. Run the `assets/create.sh` script. It calls `bat cache --build` to parse all available
|
||||
`.sublime-syntax` files and serialize them to a `syntaxes.bin` file (in this folder).
|
||||
`.sublime-syntax` files and serialize them to a `syntaxes.bin` file.
|
||||
|
||||
4. Re-compile `bat`. At compilation time, the `syntaxes.bin` file will be stored inside the
|
||||
`bat` binary.
|
||||
|
||||
5. Use `bat --list-languages` to check if the new languages are available.
|
||||
|
||||
6. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
||||
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
|
||||
|
||||
7. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
|
||||
file. A new binary cache file will be created once before every new release of `bat`.
|
||||
|
||||
### Syntax tests
|
||||
|
||||
`bat` has a set of syntax highlighting regression tests in `tests/syntax-tests`. The main idea is
|
||||
make sure that we do not run into issues we had in the past where either (1) syntax highlighting
|
||||
for some language is suddenly not working anymore or (2) `bat` suddenly crashes for some input (due
|
||||
to `regex` incompatibilities between `syntect` and Sublime Text).
|
||||
|
||||
In order to add a new test file, please follow these steps (let's take "Ruby" as an example):
|
||||
|
||||
1. Make sure that you are running the **latest version of `bat`** and that `bat` is available on
|
||||
the path. If you are creating a syntax test for a new builtin syntax (see above), make sure that
|
||||
your version of `bat` already has the new syntax builtin.
|
||||
2. Find an example Ruby source file or write one yourself. If possible, the file should aim to be
|
||||
"comprehensive" (i.e. include a lot of the possible syntax), but this is not strictly necessary.
|
||||
A simple file is better than none at all. Also, the files shouldn't be gigantic.
|
||||
3. Save the file in `tests/syntax-tests/source/Ruby` (adapt for your language). The file name could
|
||||
be `test.rb` (adapt extension) but can also be adapted if that is necessary in order for `bat` to
|
||||
highlight it correctly (e.g. `Makefile`).
|
||||
4. If you have copied the file from somewhere else, please make sure that the file *may* be copied
|
||||
under the respective license and that the license is compatible with `bat`s license. If it
|
||||
requires attribution, please add a `LICENSE.md` in the same folder with a text like this:
|
||||
```
|
||||
The `test.rb` file has been added from [enter source here] under the following license:
|
||||
|
||||
[add license text here]
|
||||
```
|
||||
5. Go to `tests/syntax-tests` and run the `update.sh` Bash script. A new file should be generated
|
||||
in the `highlighted` folder (e.g. `highlighted/Ruby/test.rb`).
|
||||
6. Use `cat` or `bat --language=txt` to display the content of this file and make sure that the
|
||||
syntax highlighting looks correct.
|
||||
7. `git add` the new files in the `source` folder as well as the autogenerated files in the
|
||||
`highlighted` folder.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Make sure that the local cache does not interfere with the internally stored syntaxes and
|
||||
@@ -44,7 +79,7 @@ The following files have been manually modified after converting from a `.tmLang
|
||||
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types and support for comments after section headers
|
||||
* `Org mode.sublime-syntax` => removed `task` file type.
|
||||
* `SML.sublime_syntax` => removed `ml` file type.
|
||||
* `Robot.sublime_syntax` => changed name to "Robot Framework"
|
||||
* `Robot.sublime_syntax` => changed name to "Robot Framework", added `.resource` extension
|
||||
|
||||
### Non-submodule additions
|
||||
|
||||
@@ -59,3 +94,4 @@ The following files have been manually modified after converting from a `.tmLang
|
||||
https://github.com/seanjames777/SML-Language-Definition/blob/master/sml.tmLanguage
|
||||
* `Cabal.sublime_syntax` has been added manually from
|
||||
https://github.com/SublimeHaskell/SublimeHaskell/ - we don't want to include the whole submodule because it includes other syntaxes ("Haskell improved") as well.
|
||||
* `Lean.sublime-syntax` has been added manually from https://github.com/leanprover/vscode-lean/blob/master/syntaxes/lean.json via conversion.
|
||||
|
||||
+27
-20
@@ -11,6 +11,7 @@ use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
||||
use path_abs::PathAbs;
|
||||
|
||||
use crate::assets_metadata::AssetsMetadata;
|
||||
use crate::bat_warning;
|
||||
use crate::error::*;
|
||||
use crate::input::{InputReader, OpenedInput, OpenedInputKind};
|
||||
use crate::syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||
@@ -37,9 +38,16 @@ impl HighlightingAssets {
|
||||
};
|
||||
|
||||
let theme_dir = source_dir.join("themes");
|
||||
|
||||
let res = theme_set.add_from_folder(&theme_dir);
|
||||
if res.is_err() {
|
||||
if theme_dir.exists() {
|
||||
let res = theme_set.add_from_folder(&theme_dir);
|
||||
if let Err(err) = res {
|
||||
println!(
|
||||
"Failed to load one or more themes from '{}' (reason: '{}')",
|
||||
theme_dir.to_string_lossy(),
|
||||
err,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
println!(
|
||||
"No themes were found in '{}', using the default set",
|
||||
theme_dir.to_string_lossy()
|
||||
@@ -189,13 +197,12 @@ impl HighlightingAssets {
|
||||
match self.theme_set.themes.get(theme) {
|
||||
Some(theme) => theme,
|
||||
None => {
|
||||
if theme == "ansi-light" || theme == "ansi-dark" {
|
||||
bat_warning!("Theme '{}' is deprecated, using 'ansi' instead.", theme);
|
||||
return self.get_theme("ansi");
|
||||
}
|
||||
if theme != "" {
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!(
|
||||
"{}: Unknown theme '{}', using default.",
|
||||
Yellow.paint("[bat warning]"),
|
||||
theme
|
||||
);
|
||||
bat_warning!("Unknown theme '{}', using default.", theme)
|
||||
}
|
||||
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||
}
|
||||
@@ -290,7 +297,7 @@ mod tests {
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::TempDir;
|
||||
|
||||
use crate::input::Input;
|
||||
|
||||
@@ -305,8 +312,7 @@ mod tests {
|
||||
SyntaxDetectionTest {
|
||||
assets: HighlightingAssets::from_binary(),
|
||||
syntax_mapping: SyntaxMapping::builtin(),
|
||||
temp_dir: TempDir::new("bat_syntax_detection_tests")
|
||||
.expect("creation of temporary directory"),
|
||||
temp_dir: TempDir::new().expect("creation of temporary directory"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,9 +327,9 @@ mod tests {
|
||||
writeln!(temp_file, "{}", first_line).unwrap();
|
||||
}
|
||||
|
||||
let input = Input::ordinary_file(file_path.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
@@ -335,9 +341,9 @@ mod tests {
|
||||
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
||||
let file_path = self.temp_dir.path().join(file_name);
|
||||
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
||||
.with_name(Some(file_path.as_os_str()));
|
||||
.with_name(Some(&file_path));
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
@@ -360,8 +366,8 @@ mod tests {
|
||||
}
|
||||
|
||||
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
||||
let input = Input::stdin().with_name(Some(OsStr::new(file_name)));
|
||||
let mut opened_input = input.open(content).unwrap();
|
||||
let input = Input::stdin().with_name(Some(file_name));
|
||||
let mut opened_input = input.open(content, None).unwrap();
|
||||
|
||||
self.assets
|
||||
.get_syntax(None, &mut opened_input, &self.syntax_mapping)
|
||||
@@ -444,6 +450,7 @@ mod tests {
|
||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||
assert_eq!(test.syntax_for_file("test.v"), "Verilog");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -515,9 +522,9 @@ mod tests {
|
||||
.expect("creation of directory succeeds");
|
||||
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
||||
|
||||
let input = Input::ordinary_file(file_path_symlink.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path_symlink);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin).unwrap();
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
test.assets
|
||||
|
||||
+18
-19
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use atty::{self, Stream};
|
||||
@@ -16,6 +16,7 @@ use console::Term;
|
||||
use crate::input::{new_file_input, new_stdin_input};
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
bat_warning,
|
||||
config::{Config, VisibleLines},
|
||||
error::*,
|
||||
input::Input,
|
||||
@@ -82,10 +83,9 @@ impl App {
|
||||
Some("always") => PagingMode::Always,
|
||||
Some("never") => PagingMode::Never,
|
||||
Some("auto") | None => {
|
||||
if self.matches.occurrences_of("plain") > 1 {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
PagingMode::Never
|
||||
} else if self.matches.is_present("no-paging") {
|
||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||
let extra_plain = self.matches.occurrences_of("plain") > 1;
|
||||
if extra_plain || self.matches.is_present("no-paging") {
|
||||
PagingMode::Never
|
||||
} else if inputs.iter().any(Input::is_stdin) {
|
||||
// If we are reading from stdin, only enable paging if we write to an
|
||||
@@ -150,10 +150,10 @@ impl App {
|
||||
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||
match self.matches.value_of("wrap") {
|
||||
Some("character") => WrappingMode::Character,
|
||||
Some("never") => WrappingMode::NoWrapping,
|
||||
Some("never") => WrappingMode::NoWrapping(true),
|
||||
Some("auto") | None => {
|
||||
if style_components.plain() {
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
} else {
|
||||
WrappingMode::Character
|
||||
}
|
||||
@@ -163,7 +163,7 @@ impl App {
|
||||
} else {
|
||||
// We don't have the tty width when piping to another program.
|
||||
// There's no point in wrapping when this is the case.
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
},
|
||||
colored_output: self.matches.is_present("force-colorization")
|
||||
|| match self.matches.value_of("color") {
|
||||
@@ -248,16 +248,19 @@ impl App {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let filenames: Option<Vec<&str>> = self
|
||||
let filenames: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of("file-name")
|
||||
.map(|values| values.collect());
|
||||
.values_of_os("file-name")
|
||||
.map(|values| values.map(Path::new).collect());
|
||||
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = Option<&Path>>> = match filenames {
|
||||
Some(filenames) => Box::new(filenames.into_iter().map(Some)),
|
||||
None => Box::new(std::iter::repeat(None)),
|
||||
};
|
||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||
let files: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of_os("FILE")
|
||||
.map(|vs| vs.map(Path::new).collect());
|
||||
|
||||
if files.is_none() {
|
||||
return Ok(vec![new_stdin_input(
|
||||
@@ -323,11 +326,7 @@ impl App {
|
||||
|
||||
// If `grid` is set, remove `rule` as it is a subset of `grid`, and print a warning.
|
||||
if styled_components.grid() && styled_components.0.remove(&StyleComponent::Rule) {
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!(
|
||||
"{}: Style 'rule' is a subset of style 'grid', 'rule' will not be visible.",
|
||||
Yellow.paint("[bat warning]"),
|
||||
);
|
||||
bat_warning!("Style 'rule' is a subset of style 'grid', 'rule' will not be visible.");
|
||||
}
|
||||
|
||||
Ok(styled_components)
|
||||
|
||||
@@ -328,7 +328,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
"Map a glob pattern to an existing syntax name. The glob pattern is matched \
|
||||
on the full path and the filename. For example, to highlight *.build files \
|
||||
with the Python syntax, use -m '*.build:Python'. To highlight files named \
|
||||
'.myignore' with the Git Ignore syntax, use -m '.myignore:Git Ignore'.",
|
||||
'.myignore' with the Git Ignore syntax, use -m '.myignore:Git Ignore'. Note \
|
||||
that the right-hand side is the *name* of the syntax, not a file extension.",
|
||||
)
|
||||
.takes_value(true),
|
||||
)
|
||||
@@ -477,6 +478,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.hidden(true)
|
||||
.help("Show bat's cache directory."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("diagnostic")
|
||||
.long("diagnostic")
|
||||
.alias("diagnostics")
|
||||
.hidden_short_help(true)
|
||||
.help("Show diagnostic information for bug reports.")
|
||||
)
|
||||
.help_message("Print this help message.")
|
||||
.version_message("Show version information.");
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@ pub fn config_file() -> PathBuf {
|
||||
env::var("BAT_CONFIG_PATH")
|
||||
.ok()
|
||||
.map(PathBuf::from)
|
||||
.filter(|config_path| config_path.is_file())
|
||||
.unwrap_or_else(|| PROJECT_DIRS.config_dir().join("config"))
|
||||
}
|
||||
|
||||
pub fn generate_config_file() -> bat::error::Result<()> {
|
||||
let config_file = config_file();
|
||||
if config_file.exists() {
|
||||
if config_file.is_file() {
|
||||
println!(
|
||||
"A config file already exists at: {}",
|
||||
config_file.to_string_lossy()
|
||||
@@ -71,7 +70,14 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
||||
#--map-syntax ".ignore:Git Ignore"
|
||||
"#;
|
||||
|
||||
fs::write(&config_file, default_config)?;
|
||||
fs::write(&config_file, default_config).map_err(|e| {
|
||||
format!(
|
||||
"Failed to create config file at '{}': {}",
|
||||
config_file.to_string_lossy(),
|
||||
e
|
||||
)
|
||||
})?;
|
||||
|
||||
println!(
|
||||
"Success! Config file written to {}",
|
||||
config_file.to_string_lossy()
|
||||
|
||||
@@ -19,10 +19,10 @@ impl BatProjectDirs {
|
||||
let config_dir_op = env::var_os("XDG_CONFIG_HOME")
|
||||
.map(PathBuf::from)
|
||||
.filter(|p| p.is_absolute())
|
||||
.or_else(|| dirs::home_dir().map(|d| d.join(".config")));
|
||||
.or_else(|| dirs_next::home_dir().map(|d| d.join(".config")));
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let config_dir_op = dirs::config_dir();
|
||||
let config_dir_op = dirs_next::config_dir();
|
||||
|
||||
let config_dir = config_dir_op.map(|d| d.join("bat"))?;
|
||||
|
||||
@@ -43,10 +43,10 @@ impl BatProjectDirs {
|
||||
let cache_dir_op = env::var_os("XDG_CACHE_HOME")
|
||||
.map(PathBuf::from)
|
||||
.filter(|p| p.is_absolute())
|
||||
.or_else(|| dirs::home_dir().map(|d| d.join(".cache")));
|
||||
.or_else(|| dirs_next::home_dir().map(|d| d.join(".cache")));
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let cache_dir_op = dirs::cache_dir();
|
||||
let cache_dir_op = dirs_next::cache_dir();
|
||||
|
||||
cache_dir_op.map(|d| d.join("bat"))
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use bat::input::Input;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
|
||||
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_file_input<'a>(file: &'a Path, name: Option<&'a Path>) -> Input<'a> {
|
||||
named(Input::ordinary_file(file), name.or(Some(file)))
|
||||
}
|
||||
|
||||
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
||||
pub fn new_stdin_input(name: Option<&Path>) -> Input {
|
||||
named(Input::stdin(), name)
|
||||
}
|
||||
|
||||
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
||||
fn named<'a>(input: Input<'a>, name: Option<&Path>) -> 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()));
|
||||
|
||||
+62
-24
@@ -9,7 +9,6 @@ mod directories;
|
||||
mod input;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::path::Path;
|
||||
@@ -35,7 +34,7 @@ use bat::{
|
||||
error::*,
|
||||
input::Input,
|
||||
style::{StyleComponent, StyleComponents},
|
||||
MappingTarget,
|
||||
MappingTarget, PagingMode,
|
||||
};
|
||||
|
||||
const THEME_PREVIEW_DATA: &[u8] = include_bytes!("../../../assets/theme_preview.rs");
|
||||
@@ -78,7 +77,9 @@ fn get_syntax_mapping_to_paths<'a>(
|
||||
map
|
||||
}
|
||||
|
||||
pub fn list_languages(config: &Config) -> Result<()> {
|
||||
pub fn get_languages(config: &Config) -> Result<String> {
|
||||
let mut result: String = String::new();
|
||||
|
||||
let assets = assets_from_cache_or_binary()?;
|
||||
let mut languages = assets
|
||||
.syntaxes()
|
||||
@@ -119,12 +120,9 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
if config.loop_through {
|
||||
for lang in languages {
|
||||
writeln!(stdout, "{}:{}", lang.name, lang.file_extensions.join(","))?;
|
||||
result += &format!("{}:{}\n", lang.name, lang.file_extensions.join(","));
|
||||
}
|
||||
} else {
|
||||
let longest = languages
|
||||
@@ -145,7 +143,7 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
||||
};
|
||||
|
||||
for lang in languages {
|
||||
write!(stdout, "{:width$}{}", lang.name, separator, width = longest)?;
|
||||
result += &format!("{:width$}{}", lang.name, separator, width = longest);
|
||||
|
||||
// Number of characters on this line so far, wrap before `desired_width`
|
||||
let mut num_chars = 0;
|
||||
@@ -156,20 +154,20 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
||||
let new_chars = word.len() + comma_separator.len();
|
||||
if num_chars + new_chars >= desired_width {
|
||||
num_chars = 0;
|
||||
write!(stdout, "\n{:width$}{}", "", separator, width = longest)?;
|
||||
result += &format!("\n{:width$}{}", "", separator, width = longest);
|
||||
}
|
||||
|
||||
num_chars += new_chars;
|
||||
write!(stdout, "{}", style.paint(&word[..]))?;
|
||||
result += &format!("{}", style.paint(&word[..]));
|
||||
if extension.peek().is_some() {
|
||||
write!(stdout, "{}", comma_separator)?;
|
||||
result += comma_separator;
|
||||
}
|
||||
}
|
||||
writeln!(stdout)?;
|
||||
result += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn theme_preview_file<'a>() -> Input<'a> {
|
||||
@@ -200,19 +198,19 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
.ok();
|
||||
writeln!(stdout)?;
|
||||
}
|
||||
writeln!(
|
||||
stdout,
|
||||
"Further themes can be installed to '{}', \
|
||||
and are added to the cache with `bat cache --build`. \
|
||||
For more information, see:\n\n \
|
||||
https://github.com/sharkdp/bat#adding-new-themes",
|
||||
PROJECT_DIRS.config_dir().join("themes").to_string_lossy()
|
||||
)?;
|
||||
} else {
|
||||
for theme in assets.themes() {
|
||||
writeln!(stdout, "{}", theme)?;
|
||||
}
|
||||
}
|
||||
writeln!(
|
||||
stdout,
|
||||
"Further themes can be installed to '{}', \
|
||||
and are added to the cache with `bat cache --build`. \
|
||||
For more information, see:\n\n \
|
||||
https://github.com/sharkdp/bat#adding-new-themes",
|
||||
config_file().join("themes").to_string_lossy()
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -228,6 +226,40 @@ fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
|
||||
fn run() -> Result<bool> {
|
||||
let app = App::new()?;
|
||||
|
||||
if app.matches.is_present("diagnostic") {
|
||||
use bugreport::{bugreport, collector::*, format::Markdown};
|
||||
let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
|
||||
.unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
|
||||
|
||||
bugreport!()
|
||||
.info(SoftwareVersion::default())
|
||||
.info(OperatingSystem::default())
|
||||
.info(CommandLine::default())
|
||||
.info(EnvironmentVariables::list(&[
|
||||
"SHELL",
|
||||
"PAGER",
|
||||
"LESS",
|
||||
"BAT_PAGER",
|
||||
"BAT_CACHE_PATH",
|
||||
"BAT_CONFIG_PATH",
|
||||
"BAT_OPTS",
|
||||
"BAT_STYLE",
|
||||
"BAT_TABS",
|
||||
"BAT_THEME",
|
||||
"XDG_CONFIG_HOME",
|
||||
"XDG_CACHE_HOME",
|
||||
"COLORTERM",
|
||||
"NO_COLOR",
|
||||
"MANPAGER",
|
||||
]))
|
||||
.info(FileContent::new("Config file", config_file()))
|
||||
.info(CompileTimeInformation::default())
|
||||
.info(CommandOutput::new("Less version", pager, &["--version"]))
|
||||
.print::<Markdown>();
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
match app.matches.subcommand() {
|
||||
("cache", Some(cache_matches)) => {
|
||||
// If there is a file named 'cache' in the current working directory,
|
||||
@@ -237,7 +269,7 @@ fn run() -> Result<bool> {
|
||||
run_cache_subcommand(cache_matches)?;
|
||||
Ok(true)
|
||||
} else {
|
||||
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
||||
let inputs = vec![Input::ordinary_file("cache")];
|
||||
let config = app.config(&inputs)?;
|
||||
|
||||
run_controller(inputs, &config)
|
||||
@@ -248,8 +280,14 @@ fn run() -> Result<bool> {
|
||||
let config = app.config(&inputs)?;
|
||||
|
||||
if app.matches.is_present("list-languages") {
|
||||
list_languages(&config)?;
|
||||
Ok(true)
|
||||
let languages: String = get_languages(&config)?;
|
||||
let inputs: Vec<Input> = vec![Input::from_reader(Box::new(languages.as_bytes()))];
|
||||
let plain_config = Config {
|
||||
style_components: StyleComponents::new(StyleComponent::Plain.components(false)),
|
||||
paging_mode: PagingMode::QuitIfOneScreen,
|
||||
..Default::default()
|
||||
};
|
||||
run_controller(inputs, &plain_config)
|
||||
} else if app.matches.is_present("list-themes") {
|
||||
list_themes(&config)?;
|
||||
Ok(true)
|
||||
|
||||
@@ -84,6 +84,15 @@ pub struct Config<'a> {
|
||||
pub highlighted_lines: HighlightedLineRanges,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "application", feature = "paging"))]
|
||||
pub fn get_pager_executable(config_pager: Option<&str>) -> Option<String> {
|
||||
if let Ok(Some(pager)) = crate::pager::get_pager(config_pager) {
|
||||
Some(pager.bin)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_config_should_include_all_lines() {
|
||||
use crate::line_range::RangeCheckResult;
|
||||
|
||||
+10
-14
@@ -13,7 +13,8 @@ use crate::output::OutputType;
|
||||
#[cfg(feature = "paging")]
|
||||
use crate::paging::PagingMode;
|
||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use clircle::Clircle;
|
||||
|
||||
pub struct Controller<'a> {
|
||||
config: &'a Config<'a>,
|
||||
@@ -67,12 +68,10 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
|
||||
let attached_to_pager = output_type.is_pager();
|
||||
let rw_cycle_detected = !attached_to_pager && {
|
||||
let identifiers: Vec<_> = inputs
|
||||
.iter()
|
||||
.flat_map(clircle::Identifier::try_from)
|
||||
.collect();
|
||||
clircle::stdout_among_inputs(&identifiers)
|
||||
let stdout_identifier = if cfg!(windows) || attached_to_pager {
|
||||
None
|
||||
} else {
|
||||
clircle::Identifier::stdout()
|
||||
};
|
||||
|
||||
let writer = output_type.handle()?;
|
||||
@@ -87,13 +86,8 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
};
|
||||
|
||||
if rw_cycle_detected {
|
||||
print_error(&"The output file is also an input!".into(), writer);
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
for (index, input) in inputs.into_iter().enumerate() {
|
||||
match input.open(io::stdin().lock()) {
|
||||
match input.open(io::stdin().lock(), stdout_identifier.as_ref()) {
|
||||
Err(error) => {
|
||||
print_error(&error, writer);
|
||||
no_errors = false;
|
||||
@@ -211,6 +205,8 @@ impl<'b> Controller<'b> {
|
||||
let mut first_range: bool = true;
|
||||
let mut mid_range: bool = false;
|
||||
|
||||
let style_snip = self.config.style_components.snip();
|
||||
|
||||
while reader.read_line(&mut line_buffer)? {
|
||||
match line_ranges.check(line_number) {
|
||||
RangeCheckResult::BeforeOrBetweenRanges => {
|
||||
@@ -221,7 +217,7 @@ impl<'b> Controller<'b> {
|
||||
}
|
||||
|
||||
RangeCheckResult::InRange => {
|
||||
if self.config.style_components.snip() {
|
||||
if style_snip {
|
||||
if first_range {
|
||||
first_range = false;
|
||||
mid_range = true;
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
#![cfg(feature = "git")]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -17,7 +16,7 @@ pub enum LineChange {
|
||||
|
||||
pub type LineChanges = HashMap<u32, LineChange>;
|
||||
|
||||
pub fn get_git_diff(filename: &OsStr) -> Option<LineChanges> {
|
||||
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
||||
let repo = Repository::discover(&filename).ok()?;
|
||||
|
||||
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||
|
||||
+55
-33
@@ -1,9 +1,9 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader, Read};
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use clircle::{Clircle, Identifier};
|
||||
use content_inspector::{self, ContentType};
|
||||
|
||||
use crate::error::*;
|
||||
@@ -69,7 +69,7 @@ impl InputDescription {
|
||||
}
|
||||
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
}
|
||||
@@ -86,7 +86,7 @@ impl<'a> InputKind<'a> {
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub(crate) struct InputMetadata {
|
||||
pub(crate) user_provided_name: Option<OsString>,
|
||||
pub(crate) user_provided_name: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct Input<'a> {
|
||||
@@ -96,7 +96,7 @@ pub struct Input<'a> {
|
||||
}
|
||||
|
||||
pub(crate) enum OpenedInputKind {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader,
|
||||
}
|
||||
@@ -109,8 +109,12 @@ pub(crate) struct OpenedInput<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Input<'a> {
|
||||
pub fn ordinary_file(path: &OsStr) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_os_string());
|
||||
pub fn ordinary_file(path: impl AsRef<Path>) -> Self {
|
||||
Self::_ordinary_file(path.as_ref())
|
||||
}
|
||||
|
||||
fn _ordinary_file(path: &Path) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_path_buf());
|
||||
Input {
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
@@ -137,14 +141,14 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
|
||||
pub fn is_stdin(&self) -> bool {
|
||||
if let InputKind::StdIn = self.kind {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(self.kind, InputKind::StdIn)
|
||||
}
|
||||
|
||||
pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
|
||||
pub fn with_name(self, provided_name: Option<impl AsRef<Path>>) -> Self {
|
||||
self._with_name(provided_name.as_ref().map(|it| it.as_ref()))
|
||||
}
|
||||
|
||||
fn _with_name(mut self, provided_name: Option<&Path>) -> Self {
|
||||
if let Some(name) = provided_name {
|
||||
self.description.name = name.to_string_lossy().to_string()
|
||||
}
|
||||
@@ -161,25 +165,55 @@ impl<'a> Input<'a> {
|
||||
&mut self.description
|
||||
}
|
||||
|
||||
pub(crate) fn open<R: BufRead + 'a>(self, stdin: R) -> Result<OpenedInput<'a>> {
|
||||
pub(crate) fn open<R: BufRead + 'a>(
|
||||
self,
|
||||
stdin: R,
|
||||
stdout_identifier: Option<&Identifier>,
|
||||
) -> 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::StdIn => {
|
||||
if let Some(stdout) = stdout_identifier {
|
||||
let input_identifier = Identifier::try_from(clircle::Stdio::Stdin)
|
||||
.map_err(|e| format!("Stdin: Error identifying file: {}", e))?;
|
||||
if stdout.surely_conflicts_with(&input_identifier) {
|
||||
return Err("IO circle detected. The input from stdin is also an output. Aborting to avoid infinite loop.".into());
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
let mut file = File::open(&path)
|
||||
.map_err(|e| format!("'{}': {}", path.to_string_lossy(), e))?;
|
||||
if file.metadata()?.is_dir() {
|
||||
return Err(format!("'{}' is a directory.", path.to_string_lossy()).into());
|
||||
}
|
||||
|
||||
if let Some(stdout) = stdout_identifier {
|
||||
let input_identifier = Identifier::try_from(file).map_err(|e| {
|
||||
format!("{}: Error identifying file: {}", path.to_string_lossy(), e)
|
||||
})?;
|
||||
if stdout.surely_conflicts_with(&input_identifier) {
|
||||
return Err(format!(
|
||||
"IO circle detected. The input from '{}' is also an output. Aborting to avoid infinite loop.",
|
||||
path.to_string_lossy()
|
||||
)
|
||||
.into());
|
||||
}
|
||||
file = input_identifier.into_inner().expect("The file was lost in the clircle::Identifier, this should not have happended...");
|
||||
}
|
||||
|
||||
InputReader::new(BufReader::new(file))
|
||||
},
|
||||
}),
|
||||
@@ -193,18 +227,6 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&'_ Input<'_>> for clircle::Identifier {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(input: &Input) -> std::result::Result<clircle::Identifier, ()> {
|
||||
match input.kind {
|
||||
InputKind::OrdinaryFile(ref path) => Self::try_from(Path::new(path)).map_err(|_| ()),
|
||||
InputKind::StdIn => Self::try_from(clircle::Stdio::Stdin).map_err(|_| ()),
|
||||
InputKind::CustomReader(_) => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct InputReader<'a> {
|
||||
inner: Box<dyn BufRead + 'a>,
|
||||
pub(crate) first_line: Vec<u8>,
|
||||
|
||||
+17
-3
@@ -1,16 +1,17 @@
|
||||
#![cfg(feature = "paging")]
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::process::Command;
|
||||
|
||||
pub fn retrieve_less_version() -> Option<usize> {
|
||||
let cmd = Command::new("less").arg("--version").output().ok()?;
|
||||
pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
|
||||
let cmd = Command::new(less_path).arg("--version").output().ok()?;
|
||||
parse_less_version(&cmd.stdout)
|
||||
}
|
||||
|
||||
fn parse_less_version(output: &[u8]) -> Option<usize> {
|
||||
if output.starts_with(b"less ") {
|
||||
let version = std::str::from_utf8(&output[5..]).ok()?;
|
||||
let end = version.find(' ')?;
|
||||
let end = version.find(|c: char| !c.is_ascii_digit())?;
|
||||
version[..end].parse::<usize>().ok()
|
||||
} else {
|
||||
None
|
||||
@@ -56,6 +57,19 @@ Home page: http://www.greenwoodsoftware.com/less";
|
||||
assert_eq!(Some(551), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_581_2() {
|
||||
let output = b"less 581.2 (PCRE2 regular expressions)
|
||||
Copyright (C) 1984-2021 Mark Nudelman
|
||||
|
||||
less comes with NO WARRANTY, to the extent permitted by law.
|
||||
For information about the terms of redistribution,
|
||||
see the file named README in the less distribution.
|
||||
Home page: https://greenwoodsoftware.com/less";
|
||||
|
||||
assert_eq!(Some(581), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_wrong_program() {
|
||||
let output = b"more from util-linux 2.34";
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
//! .unwrap();
|
||||
//! ```
|
||||
|
||||
mod macros;
|
||||
|
||||
pub mod assets;
|
||||
pub mod assets_metadata;
|
||||
pub mod config;
|
||||
@@ -31,6 +33,8 @@ mod less;
|
||||
pub mod line_range;
|
||||
mod output;
|
||||
#[cfg(feature = "paging")]
|
||||
mod pager;
|
||||
#[cfg(feature = "paging")]
|
||||
pub(crate) mod paging;
|
||||
mod preprocessor;
|
||||
mod pretty_printer;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#[macro_export]
|
||||
macro_rules! bat_warning {
|
||||
($($arg:tt)*) => ({
|
||||
use ansi_term::Colour::Yellow;
|
||||
eprintln!("{}: {}", Yellow.paint("[bat warning]"), format!($($arg)*));
|
||||
})
|
||||
}
|
||||
+52
-85
@@ -48,100 +48,71 @@ impl OutputType {
|
||||
wrapping_mode: WrappingMode,
|
||||
pager_from_config: Option<&str>,
|
||||
) -> Result<Self> {
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use crate::pager::{self, PagerKind, PagerSource};
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
let mut replace_arguments_to_less = false;
|
||||
let pager_opt =
|
||||
pager::get_pager(pager_from_config).chain_err(|| "Could not parse pager command.")?;
|
||||
|
||||
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 = match pager_opt {
|
||||
Some(pager) => pager,
|
||||
None => return Ok(OutputType::stdout()),
|
||||
};
|
||||
|
||||
let pager_from_config = pager_from_config.map(|p| p.to_string());
|
||||
|
||||
if pager_from_config.is_some() {
|
||||
replace_arguments_to_less = false;
|
||||
if pager.kind == PagerKind::Bat {
|
||||
return Err(ErrorKind::InvalidPagerValueBat.into());
|
||||
}
|
||||
|
||||
let pager = pager_from_config
|
||||
.or(pager_from_env)
|
||||
.unwrap_or_else(|| String::from("less"));
|
||||
let mut p = Command::new(&pager.bin);
|
||||
let args = pager.args;
|
||||
|
||||
let pagerflags =
|
||||
shell_words::split(&pager).chain_err(|| "Could not parse pager command.")?;
|
||||
if pager.kind == PagerKind::Less {
|
||||
// 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.
|
||||
let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
|
||||
|
||||
match pagerflags.split_first() {
|
||||
Some((pager_name, args)) => {
|
||||
let pager_path = PathBuf::from(pager_name);
|
||||
|
||||
if pager_path.file_stem() == Some(&OsString::from("bat")) {
|
||||
return Err(ErrorKind::InvalidPagerValueBat.into());
|
||||
if args.is_empty() || replace_arguments_to_less {
|
||||
p.arg("--RAW-CONTROL-CHARS");
|
||||
if single_screen_action == SingleScreenAction::Quit {
|
||||
p.arg("--quit-if-one-screen");
|
||||
}
|
||||
|
||||
let is_less = pager_path.file_stem() == Some(&OsString::from("less"));
|
||||
if wrapping_mode == WrappingMode::NoWrapping(true) {
|
||||
p.arg("--chop-long-lines");
|
||||
}
|
||||
|
||||
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 single_screen_action == SingleScreenAction::Quit {
|
||||
p.arg("--quit-if-one-screen");
|
||||
}
|
||||
|
||||
if wrapping_mode == WrappingMode::NoWrapping {
|
||||
p.arg("--chop-long-lines");
|
||||
}
|
||||
|
||||
// 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);
|
||||
// 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(&pager.bin) {
|
||||
None => {
|
||||
p.arg("--no-init");
|
||||
}
|
||||
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()))
|
||||
Some(version) if (version < 530 || (cfg!(windows) && version < 558)) => {
|
||||
p.arg("--no-init");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
p.args(args);
|
||||
}
|
||||
None => Ok(OutputType::stdout()),
|
||||
}
|
||||
p.env("LESSCHARSET", "UTF-8");
|
||||
} else {
|
||||
p.args(args);
|
||||
};
|
||||
|
||||
Ok(p.stdin(Stdio::piped())
|
||||
.spawn()
|
||||
.map(OutputType::Pager)
|
||||
.unwrap_or_else(|_| OutputType::stdout()))
|
||||
}
|
||||
|
||||
pub(crate) fn stdout() -> Self {
|
||||
@@ -150,11 +121,7 @@ impl OutputType {
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
pub(crate) fn is_pager(&self) -> bool {
|
||||
if let OutputType::Pager(_) = self {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(self, OutputType::Pager(_))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "paging"))]
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
use shell_words::ParseError;
|
||||
use std::env;
|
||||
|
||||
/// If we use a pager, this enum tells us from where we were told to use it.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) enum PagerSource {
|
||||
/// From --config
|
||||
Config,
|
||||
|
||||
/// From the env var BAT_PAGER
|
||||
EnvVarBatPager,
|
||||
|
||||
/// From the env var PAGER
|
||||
EnvVarPager,
|
||||
|
||||
/// No pager was specified, default is used
|
||||
Default,
|
||||
}
|
||||
|
||||
/// We know about some pagers, for example 'less'. This is a list of all pagers we know about
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) enum PagerKind {
|
||||
/// bat
|
||||
Bat,
|
||||
|
||||
/// less
|
||||
Less,
|
||||
|
||||
/// more
|
||||
More,
|
||||
|
||||
/// most
|
||||
Most,
|
||||
|
||||
/// A pager we don't know about
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl PagerKind {
|
||||
fn from_bin(bin: &str) -> PagerKind {
|
||||
use std::path::Path;
|
||||
|
||||
match Path::new(bin)
|
||||
.file_stem()
|
||||
.map(|s| s.to_string_lossy())
|
||||
.as_deref()
|
||||
{
|
||||
Some("bat") => PagerKind::Bat,
|
||||
Some("less") => PagerKind::Less,
|
||||
Some("more") => PagerKind::More,
|
||||
Some("most") => PagerKind::Most,
|
||||
_ => PagerKind::Unknown,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A pager such as 'less', and from where we got it.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Pager {
|
||||
/// The pager binary
|
||||
pub bin: String,
|
||||
|
||||
/// The pager binary arguments (that we might tweak)
|
||||
pub args: Vec<String>,
|
||||
|
||||
/// What pager this is
|
||||
pub kind: PagerKind,
|
||||
|
||||
/// From where this pager comes
|
||||
pub source: PagerSource,
|
||||
}
|
||||
|
||||
impl Pager {
|
||||
fn new(bin: &str, args: &[String], kind: PagerKind, source: PagerSource) -> Pager {
|
||||
Pager {
|
||||
bin: String::from(bin),
|
||||
args: args.to_vec(),
|
||||
kind,
|
||||
source,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns what pager to use, after looking at both config and environment variables.
|
||||
pub(crate) fn get_pager(config_pager: Option<&str>) -> Result<Option<Pager>, ParseError> {
|
||||
let bat_pager = env::var("BAT_PAGER");
|
||||
let pager = env::var("PAGER");
|
||||
|
||||
let (cmd, source) = match (config_pager, &bat_pager, &pager) {
|
||||
(Some(config_pager), _, _) => (config_pager, PagerSource::Config),
|
||||
(_, Ok(bat_pager), _) => (bat_pager.as_str(), PagerSource::EnvVarBatPager),
|
||||
(_, _, Ok(pager)) => (pager.as_str(), PagerSource::EnvVarPager),
|
||||
_ => ("less", PagerSource::Default),
|
||||
};
|
||||
|
||||
let parts = shell_words::split(cmd)?;
|
||||
match parts.split_first() {
|
||||
Some((bin, args)) => {
|
||||
let kind = PagerKind::from_bin(bin);
|
||||
|
||||
let use_less_instead = match (&source, &kind) {
|
||||
// 'more' and 'most' do not supports colors; automatically use 'less' instead
|
||||
// if the problematic pager came from the generic PAGER env var
|
||||
(PagerSource::EnvVarPager, PagerKind::More) => true,
|
||||
(PagerSource::EnvVarPager, PagerKind::Most) => true,
|
||||
|
||||
// If PAGER=bat, silently use 'less' instead to prevent recursion ...
|
||||
(PagerSource::EnvVarPager, PagerKind::Bat) => true,
|
||||
|
||||
// Never silently use less if BAT_PAGER or --pager has been specified
|
||||
_ => false,
|
||||
};
|
||||
|
||||
Ok(Some(if use_less_instead {
|
||||
let no_args = vec![];
|
||||
Pager::new("less", &no_args, PagerKind::Less, PagerSource::EnvVarPager)
|
||||
} else {
|
||||
Pager::new(bin, args, kind, source)
|
||||
}))
|
||||
}
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -72,7 +72,7 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
||||
}
|
||||
}
|
||||
// line feed
|
||||
'\x0A' => output.push('␊'),
|
||||
'\x0A' => output.push_str("␊\x0A"),
|
||||
// carriage return
|
||||
'\x0D' => output.push('␍'),
|
||||
// null
|
||||
|
||||
+15
-50
@@ -1,5 +1,5 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
use console::Term;
|
||||
use syntect::parsing::SyntaxReference;
|
||||
@@ -71,7 +71,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
|
||||
/// Add a file which should be pretty-printed
|
||||
pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
|
||||
pub fn input_file(&mut self, path: impl AsRef<Path>) -> &mut Self {
|
||||
self.input(Input::from_file(path).kind("File"))
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
pub fn input_files<I, P>(&mut self, paths: I) -> &mut Self
|
||||
where
|
||||
I: IntoIterator<Item = P>,
|
||||
P: AsRef<OsStr>,
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
self.inputs(paths.into_iter().map(Input::from_file))
|
||||
}
|
||||
@@ -90,48 +90,17 @@ impl<'a> PrettyPrinter<'a> {
|
||||
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::from_stdin().name(name).kind("File"));
|
||||
self
|
||||
}
|
||||
|
||||
/// Add a byte string as an input
|
||||
pub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self {
|
||||
self.input_from_reader(content)
|
||||
}
|
||||
|
||||
/// 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],
|
||||
name: impl AsRef<OsStr>,
|
||||
) -> &mut Self {
|
||||
self.input_from_reader_with_name(content, name)
|
||||
}
|
||||
|
||||
/// 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(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(reader).name(name).kind("File"));
|
||||
self
|
||||
}
|
||||
|
||||
/// Specify the syntax file which should be used (default: auto-detect)
|
||||
pub fn language(&mut self, language: &'a str) -> &mut Self {
|
||||
self.config.language = Some(language);
|
||||
@@ -188,19 +157,9 @@ impl<'a> PrettyPrinter<'a> {
|
||||
|
||||
/// Whether to show modification markers for VCS changes. This has no effect if
|
||||
/// the `git` feature is not activated.
|
||||
#[cfg_attr(
|
||||
not(feature = "git"),
|
||||
deprecated(
|
||||
note = "Using vcs_modification_markers without the 'git' feature has no effect. \
|
||||
The function will be removed (for non-'git' use cases) in the future."
|
||||
)
|
||||
)]
|
||||
#[allow(unused_variables)]
|
||||
#[cfg(feature = "git")]
|
||||
pub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self {
|
||||
#[cfg(feature = "git")]
|
||||
{
|
||||
self.active_style_components.vcs_modification_markers = yes;
|
||||
}
|
||||
self.active_style_components.vcs_modification_markers = yes;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -320,6 +279,12 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PrettyPrinter<'_> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// An input source for the pretty printer.
|
||||
pub struct Input<'a> {
|
||||
input: input::Input<'a>,
|
||||
@@ -332,8 +297,8 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
|
||||
/// A new input from a file.
|
||||
pub fn from_file(path: impl AsRef<OsStr>) -> Self {
|
||||
input::Input::ordinary_file(path.as_ref()).into()
|
||||
pub fn from_file(path: impl AsRef<Path>) -> Self {
|
||||
input::Input::ordinary_file(path).into()
|
||||
}
|
||||
|
||||
/// A new input from bytes.
|
||||
@@ -348,8 +313,8 @@ impl<'a> Input<'a> {
|
||||
|
||||
/// 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()));
|
||||
pub fn name(mut self, name: impl AsRef<Path>) -> Self {
|
||||
self.input = self.input.with_name(Some(name));
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
+19
-16
@@ -91,9 +91,6 @@ impl<'a> Printer for SimplePrinter<'a> {
|
||||
if self.config.show_nonprintable {
|
||||
let line = replace_nonprintable(line_buffer, self.config.tab_width);
|
||||
write!(handle, "{}", line)?;
|
||||
if line_buffer.last() == Some(&b'\n') {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
} else {
|
||||
handle.write_all(line_buffer)?
|
||||
};
|
||||
@@ -427,7 +424,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
}
|
||||
|
||||
// Line contents.
|
||||
if self.config.wrapping_mode == WrappingMode::NoWrapping {
|
||||
if matches!(self.config.wrapping_mode, WrappingMode::NoWrapping(_)) {
|
||||
let true_color = self.config.true_color;
|
||||
let colored_output = self.config.colored_output;
|
||||
let italics = self.config.use_italic_text;
|
||||
@@ -451,7 +448,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
if text.len() != text_trimmed.len() {
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background = Some(to_ansi_color(background_color, true_color));
|
||||
ansi_style.background = to_ansi_color(background_color, true_color);
|
||||
let width = if cursor_total <= cursor_max {
|
||||
cursor_max - cursor_total + 1
|
||||
} else {
|
||||
@@ -463,7 +460,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
if line.bytes().next_back() != Some(b'\n') {
|
||||
if !self.config.style_components.plain() && line.bytes().next_back() != Some(b'\n') {
|
||||
writeln!(handle)?;
|
||||
}
|
||||
} else {
|
||||
@@ -592,8 +589,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
||||
|
||||
if let Some(background_color) = background_color {
|
||||
let mut ansi_style = Style::default();
|
||||
ansi_style.background =
|
||||
Some(to_ansi_color(background_color, self.config.true_color));
|
||||
ansi_style.background = to_ansi_color(background_color, self.config.true_color);
|
||||
|
||||
write!(
|
||||
handle,
|
||||
@@ -627,20 +623,27 @@ impl Colors {
|
||||
}
|
||||
|
||||
fn colored(theme: &Theme, true_color: bool) -> Self {
|
||||
let gutter_color = theme
|
||||
.settings
|
||||
.gutter_foreground
|
||||
.map(|c| to_ansi_color(c, true_color))
|
||||
.unwrap_or(Fixed(DEFAULT_GUTTER_COLOR));
|
||||
let gutter_style = Style {
|
||||
foreground: match theme.settings.gutter_foreground {
|
||||
// If the theme provides a gutter foreground color, use it.
|
||||
// Note: It might be the special value #00000001, in which case
|
||||
// to_ansi_color returns None and we use an empty Style
|
||||
// (resulting in the terminal's default foreground color).
|
||||
Some(c) => to_ansi_color(c, true_color),
|
||||
// Otherwise, use a specific fallback color.
|
||||
None => Some(Fixed(DEFAULT_GUTTER_COLOR)),
|
||||
},
|
||||
..Style::default()
|
||||
};
|
||||
|
||||
Colors {
|
||||
grid: gutter_color.normal(),
|
||||
rule: gutter_color.normal(),
|
||||
grid: gutter_style,
|
||||
rule: gutter_style,
|
||||
filename: Style::new().bold(),
|
||||
git_added: Green.normal(),
|
||||
git_removed: Red.normal(),
|
||||
git_modified: Yellow.normal(),
|
||||
line_number: gutter_color.normal(),
|
||||
line_number: gutter_style,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ impl<'a> SyntaxMapping<'a> {
|
||||
MappingTarget::MapTo("Bourne Again Shell (bash)"),
|
||||
)
|
||||
.unwrap();
|
||||
mapping
|
||||
.insert("*.pac", MappingTarget::MapTo("JavaScript (Babel)"))
|
||||
.unwrap();
|
||||
|
||||
// See #1008
|
||||
mapping
|
||||
@@ -54,6 +57,11 @@ impl<'a> SyntaxMapping<'a> {
|
||||
.insert("*.conf", MappingTarget::MapToUnknown)
|
||||
.unwrap();
|
||||
|
||||
// Re-insert a mapping for resolv.conf, see #1510
|
||||
mapping
|
||||
.insert("resolv.conf", MappingTarget::MapTo("resolv"))
|
||||
.unwrap();
|
||||
|
||||
for glob in &[
|
||||
"/etc/nginx/**/*.conf",
|
||||
"/etc/nginx/sites-*/**/*",
|
||||
|
||||
+19
-9
@@ -3,13 +3,13 @@ use ansi_term::{self, Style};
|
||||
|
||||
use syntect::highlighting::{self, FontStyle};
|
||||
|
||||
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Color {
|
||||
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ansi_term::Color> {
|
||||
if color.a == 0 {
|
||||
// Themes can specify one of the user-configurable terminal colors by
|
||||
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
|
||||
// to the 8-bit color palette number. The built-in themes ansi-light,
|
||||
// ansi-dark, base16, and base16-256 use this.
|
||||
match color.r {
|
||||
// to the 8-bit color palette number. The built-in themes ansi, base16,
|
||||
// and base16-256 use this.
|
||||
Some(match color.r {
|
||||
// For the first 8 colors, use the Color enum to produce ANSI escape
|
||||
// sequences using codes 30-37 (foreground) and 40-47 (background).
|
||||
// For example, red foreground is \x1b[31m. This works on terminals
|
||||
@@ -31,11 +31,18 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term:
|
||||
// 90-97 (foreground) and 100-107 (background), we should use those
|
||||
// for values 0x08 to 0x0f and only use Fixed for 0x10 to 0xff.
|
||||
n => Fixed(n),
|
||||
}
|
||||
})
|
||||
} else if color.a == 1 {
|
||||
// Themes can specify the terminal's default foreground/background color
|
||||
// (i.e. no escape sequence) using the encoding #RRGGBBAA with AA set to
|
||||
// 01. The built-in theme ansi uses this.
|
||||
None
|
||||
} else if true_color {
|
||||
RGB(color.r, color.g, color.b)
|
||||
Some(RGB(color.r, color.g, color.b))
|
||||
} else {
|
||||
Fixed(ansi_colours::ansi256_from_rgb((color.r, color.g, color.b)))
|
||||
Some(Fixed(ansi_colours::ansi256_from_rgb((
|
||||
color.r, color.g, color.b,
|
||||
))))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +61,10 @@ pub fn as_terminal_escaped(
|
||||
let mut style = if !colored {
|
||||
Style::default()
|
||||
} else {
|
||||
let mut color = Style::from(to_ansi_color(style.foreground, true_color));
|
||||
let mut color = Style {
|
||||
foreground: to_ansi_color(style.foreground, true_color),
|
||||
..Style::default()
|
||||
};
|
||||
if style.font_style.contains(FontStyle::BOLD) {
|
||||
color = color.bold();
|
||||
}
|
||||
@@ -67,6 +77,6 @@ pub fn as_terminal_escaped(
|
||||
color
|
||||
};
|
||||
|
||||
style.background = background_color.map(|c| to_ansi_color(c, true_color));
|
||||
style.background = background_color.and_then(|c| to_ansi_color(c, true_color));
|
||||
style.paint(text).to_string()
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum WrappingMode {
|
||||
Character,
|
||||
NoWrapping,
|
||||
// The bool specifies whether wrapping has been explicitly disabled by the user via --wrap=never
|
||||
NoWrapping(bool),
|
||||
}
|
||||
|
||||
impl Default for WrappingMode {
|
||||
fn default() -> Self {
|
||||
WrappingMode::NoWrapping
|
||||
WrappingMode::NoWrapping(false)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -8,7 +8,7 @@ fn all_themes_are_present() {
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
let mut themes: Vec<_> = assets.themes().collect();
|
||||
themes.sort();
|
||||
themes.sort_unstable();
|
||||
|
||||
assert_eq!(
|
||||
themes,
|
||||
@@ -30,13 +30,12 @@ fn all_themes_are_present() {
|
||||
"Solarized (light)",
|
||||
"Sublime Snazzy",
|
||||
"TwoDark",
|
||||
"ansi-dark",
|
||||
"ansi-light",
|
||||
"Visual Studio Dark+",
|
||||
"ansi",
|
||||
"base16",
|
||||
"base16-256",
|
||||
"gruvbox",
|
||||
"gruvbox-dark",
|
||||
"gruvbox-light",
|
||||
"gruvbox-white",
|
||||
"zenburn"
|
||||
]
|
||||
);
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
if ! which hyperfine > /dev/null 2>&1; then
|
||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
|
||||
Vendored
+50
-6
@@ -1,28 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
if ! which hyperfine > /dev/null 2>&1; then
|
||||
# Check that Hyperfine is installed.
|
||||
if ! command -v hyperfine > /dev/null 2>&1; then
|
||||
echo "'hyperfine' does not seem to be installed."
|
||||
echo "You can get it here: https://github.com/sharkdp/hyperfine"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine the target directories.
|
||||
get_target_dir() {
|
||||
if [[ -f "$HOME/.cargo/config" ]]; then
|
||||
grep 'target-dir[[:space:]]*=' "$HOME/.cargo/config" \
|
||||
| sed 's/^[[:space:]]*target-dir[[:space:]]*=//; s/^[[:space:]]*"//; s/"[[:space:]]*$//' \
|
||||
&& return 0
|
||||
fi
|
||||
|
||||
echo "../../target"
|
||||
}
|
||||
|
||||
TARGET_DIR="$(get_target_dir)"
|
||||
TARGET_DEBUG="${TARGET_DIR}/debug/bat"
|
||||
TARGET_RELEASE="${TARGET_DIR}/release/bat"
|
||||
|
||||
# Determine which target to benchmark.
|
||||
BAT=''
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--system) BAT="bat" ;;
|
||||
--debug) BAT="$TARGET_DEBUG" ;;
|
||||
--release) BAT="$TARGET_RELEASE" ;;
|
||||
--bat=*) BAT="${arg:6}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$BAT" ]]; then
|
||||
echo "A build of 'bat' must be specified for benchmarking."
|
||||
echo "You can use '--system', '--debug', or '--release'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure that the target is built.
|
||||
if ! command -v "$BAT" &>/dev/null; then
|
||||
echo "Could not find the build of bat to benchmark."
|
||||
case "$BAT" in
|
||||
"bat") echo "Make you sure to symlink 'batcat' as 'bat'." ;;
|
||||
"$TARGET_DEBUG") echo "Make you sure to 'cargo build' first." ;;
|
||||
"$TARGET_RELEASE") echo "Make you sure to 'cargo build --release' first." ;;
|
||||
esac
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run the benchmark.
|
||||
echo "### Startup time"
|
||||
echo
|
||||
|
||||
hyperfine --warmup 3 bat
|
||||
hyperfine --warmup 3 "$BAT"
|
||||
|
||||
echo
|
||||
echo "### Plain text"
|
||||
echo
|
||||
|
||||
hyperfine --warmup 3 "bat --language txt --paging=never 'test-src/jquery-3.3.1.js'"
|
||||
hyperfine --warmup 3 "$(printf "%q" "$BAT") --language txt --paging=never 'test-src/jquery-3.3.1.js'"
|
||||
|
||||
echo
|
||||
echo "### Time to syntax-highlight large files"
|
||||
echo
|
||||
|
||||
for SRC in test-src/*; do
|
||||
hyperfine --warmup 3 "bat --style=full --color=always --paging=never '$SRC'"
|
||||
hyperfine --warmup 3 "$(printf "%q" "$BAT") --style=full --color=always --paging=never $(printf "%q" "$SRC")"
|
||||
done
|
||||
|
||||
Vendored
+322
-28
@@ -1,14 +1,37 @@
|
||||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_cmd::cargo::CommandCargoExt;
|
||||
use predicates::{prelude::predicate, str::PredicateStrExt};
|
||||
use std::fs::File;
|
||||
use serial_test::serial;
|
||||
use std::path::Path;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::process::Command;
|
||||
use std::str::from_utf8;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
pub use std::fs::File;
|
||||
pub use std::io::{self, Write};
|
||||
pub use std::os::unix::io::FromRawFd;
|
||||
pub use std::path::PathBuf;
|
||||
pub use std::process::Stdio;
|
||||
pub use std::thread;
|
||||
pub use std::time::Duration;
|
||||
|
||||
pub use assert_cmd::assert::OutputAssertExt;
|
||||
pub use nix::pty::{openpty, OpenptyResult};
|
||||
pub use wait_timeout::ChildExt;
|
||||
|
||||
pub const SAFE_CHILD_PROCESS_CREATION_TIME: Duration = Duration::from_millis(100);
|
||||
pub const CHILD_WAIT_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
}
|
||||
#[cfg(unix)]
|
||||
use unix::*;
|
||||
|
||||
mod utils;
|
||||
use utils::mocked_pagers;
|
||||
|
||||
const EXAMPLES_DIR: &str = "tests/examples";
|
||||
|
||||
fn bat_as_std() -> Command {
|
||||
fn bat_raw_command_with_config() -> Command {
|
||||
let mut cmd = Command::cargo_bin("bat").unwrap();
|
||||
cmd.current_dir("tests/examples");
|
||||
cmd.env_remove("PAGER");
|
||||
@@ -20,14 +43,18 @@ fn bat_as_std() -> Command {
|
||||
cmd
|
||||
}
|
||||
|
||||
fn bat_raw_command() -> Command {
|
||||
let mut cmd = bat_raw_command_with_config();
|
||||
cmd.arg("--no-config");
|
||||
cmd
|
||||
}
|
||||
|
||||
fn bat_with_config() -> assert_cmd::Command {
|
||||
assert_cmd::Command::from_std(bat_as_std())
|
||||
assert_cmd::Command::from_std(bat_raw_command_with_config())
|
||||
}
|
||||
|
||||
fn bat() -> assert_cmd::Command {
|
||||
let mut cmd = bat_with_config();
|
||||
cmd.arg("--no-config");
|
||||
cmd
|
||||
assert_cmd::Command::from_std(bat_raw_command())
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -196,28 +223,120 @@ fn line_range_multiple() {
|
||||
.stdout("line 1\nline 2\nline 4\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_io_cycle() {
|
||||
let file_out = Stdio::from(File::open("tests/examples/cycle.txt").unwrap());
|
||||
bat_as_std()
|
||||
.arg("test.txt")
|
||||
.arg("cycle.txt")
|
||||
.stdout(file_out)
|
||||
.assert()
|
||||
.failure();
|
||||
#[cfg(unix)]
|
||||
fn setup_temp_file(content: &[u8]) -> io::Result<(PathBuf, tempfile::TempDir)> {
|
||||
let dir = tempfile::tempdir().expect("Couldn't create tempdir");
|
||||
let path = dir.path().join("temp_file");
|
||||
File::create(&path)?.write_all(content)?;
|
||||
Ok((path, dir))
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn stdin_to_stdout_cycle() {
|
||||
let file_out = Stdio::from(File::open("tests/examples/cycle.txt").unwrap());
|
||||
let file_in = Stdio::from(File::open("tests/examples/cycle.txt").unwrap());
|
||||
bat_as_std()
|
||||
.stdin(file_in)
|
||||
fn basic_io_cycle() -> io::Result<()> {
|
||||
let (filename, dir) = setup_temp_file(b"I am not empty")?;
|
||||
|
||||
let file_out = Stdio::from(File::create(&filename)?);
|
||||
let res = bat_raw_command()
|
||||
.arg("test.txt")
|
||||
.arg(&filename)
|
||||
.stdout(file_out)
|
||||
.assert();
|
||||
drop(dir);
|
||||
res.failure();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn first_file_cyclic_is_ok() -> io::Result<()> {
|
||||
let (filename, dir) = setup_temp_file(b"I am not empty")?;
|
||||
|
||||
let file_out = Stdio::from(File::create(&filename)?);
|
||||
let res = bat_raw_command()
|
||||
.arg(&filename)
|
||||
.arg("test.txt")
|
||||
.stdout(file_out)
|
||||
.assert();
|
||||
drop(dir);
|
||||
res.success();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn empty_file_cycle_is_ok() -> io::Result<()> {
|
||||
let (filename, dir) = setup_temp_file(b"I am not empty")?;
|
||||
|
||||
let file_out = Stdio::from(File::create(&filename)?);
|
||||
let res = bat_raw_command()
|
||||
.arg("empty.txt")
|
||||
.arg(&filename)
|
||||
.stdout(file_out)
|
||||
.assert();
|
||||
drop(dir);
|
||||
res.success();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn stdin_to_stdout_cycle() -> io::Result<()> {
|
||||
let (filename, dir) = setup_temp_file(b"I am not empty")?;
|
||||
let file_in = Stdio::from(File::open(&filename)?);
|
||||
let file_out = Stdio::from(File::create(&filename)?);
|
||||
let res = bat_raw_command()
|
||||
.arg("test.txt")
|
||||
.arg("-")
|
||||
.stdin(file_in)
|
||||
.stdout(file_out)
|
||||
.assert()
|
||||
.failure();
|
||||
.assert();
|
||||
drop(dir);
|
||||
res.failure();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn no_args_doesnt_break() {
|
||||
// To simulate bat getting started from the shell, a process is created with stdin and stdout
|
||||
// as the slave end of a pseudo terminal. Although both point to the same "file", bat should
|
||||
// not exit, because in this case it is safe to read and write to the same fd, which is why
|
||||
// this test exists.
|
||||
let OpenptyResult { master, slave } = openpty(None, None).expect("Couldn't open pty.");
|
||||
let mut master = unsafe { File::from_raw_fd(master) };
|
||||
let stdin = unsafe { Stdio::from_raw_fd(slave) };
|
||||
let stdout = unsafe { Stdio::from_raw_fd(slave) };
|
||||
|
||||
let mut child = bat_raw_command()
|
||||
.stdin(stdin)
|
||||
.stdout(stdout)
|
||||
.spawn()
|
||||
.expect("Failed to start.");
|
||||
|
||||
// Some time for the child process to start and to make sure, that we can poll the exit status.
|
||||
// Although this waiting period is not necessary, it is best to keep it in and be absolutely
|
||||
// sure, that the try_wait does not error later.
|
||||
thread::sleep(SAFE_CHILD_PROCESS_CREATION_TIME);
|
||||
|
||||
// The child process should be running and waiting for input,
|
||||
// therefore no exit status should be available.
|
||||
let exit_status = child
|
||||
.try_wait()
|
||||
.expect("Error polling exit status, this should never happen.");
|
||||
assert!(exit_status.is_none());
|
||||
|
||||
// Write Ctrl-D (end of transmission) to the pty.
|
||||
master
|
||||
.write_all(&[0x04])
|
||||
.expect("Couldn't write EOT character to master end.");
|
||||
|
||||
let exit_status = child
|
||||
.wait_timeout(CHILD_WAIT_TIMEOUT)
|
||||
.expect("Error polling exit status, this should never happen.")
|
||||
.expect("Exit status not set, but the child should have exited already.");
|
||||
|
||||
assert!(exit_status.success());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -436,6 +555,28 @@ fn pager_disable() {
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_var_pager_value_bat() {
|
||||
bat()
|
||||
.env("PAGER", "bat")
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_var_bat_pager_value_bat() {
|
||||
bat()
|
||||
.env("BAT_PAGER", "bat")
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("bat as a pager is disallowed"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pager_value_bat() {
|
||||
bat()
|
||||
@@ -443,7 +584,86 @@ fn pager_value_bat() {
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.failure();
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("bat as a pager is disallowed"));
|
||||
}
|
||||
|
||||
/// We shall use less instead of most if PAGER is used since PAGER
|
||||
/// is a generic env var
|
||||
#[test]
|
||||
#[serial] // Because of PATH
|
||||
fn pager_most_from_pager_env_var() {
|
||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||
// If the output is not "I am most" then we know 'most' is not used
|
||||
bat()
|
||||
.env("PAGER", mocked_pagers::from("most"))
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
});
|
||||
}
|
||||
|
||||
/// If the bat-specific BAT_PAGER is used, obey the wish of the user
|
||||
/// and allow 'most'
|
||||
#[test]
|
||||
#[serial] // Because of PATH
|
||||
fn pager_most_from_bat_pager_env_var() {
|
||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||
bat()
|
||||
.env("BAT_PAGER", mocked_pagers::from("most"))
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("I am most"));
|
||||
});
|
||||
}
|
||||
|
||||
/// Same reasoning with --pager as with BAT_PAGER
|
||||
#[test]
|
||||
#[serial] // Because of PATH
|
||||
fn pager_most_from_pager_arg() {
|
||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||
bat()
|
||||
.arg("--paging=always")
|
||||
.arg(format!("--pager={}", mocked_pagers::from("most")))
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("I am most"));
|
||||
});
|
||||
}
|
||||
|
||||
/// Make sure the logic for 'most' applies even if an argument is passed
|
||||
#[test]
|
||||
#[serial] // Because of PATH
|
||||
fn pager_most_with_arg() {
|
||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||
bat()
|
||||
.env("PAGER", format!("{} -w", mocked_pagers::from("most")))
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
});
|
||||
}
|
||||
|
||||
/// Sanity check that 'more' is treated like 'most'
|
||||
#[test]
|
||||
#[serial] // Because of PATH
|
||||
fn pager_more() {
|
||||
mocked_pagers::with_mocked_versions_of_more_and_most_in_path(|| {
|
||||
bat()
|
||||
.env("PAGER", mocked_pagers::from("more"))
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("hello world\n").normalize());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -469,6 +689,17 @@ fn alias_pager_disable_long_overrides_short() {
|
||||
.stdout(predicate::eq("pager-output\n").normalize());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pager_failed_to_parse() {
|
||||
bat()
|
||||
.env("BAT_PAGER", "mismatched-quotes 'a")
|
||||
.arg("--paging=always")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains("Could not parse pager command"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_location_test() {
|
||||
bat_with_config()
|
||||
@@ -477,6 +708,33 @@ fn config_location_test() {
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("bat.conf\n");
|
||||
|
||||
bat_with_config()
|
||||
.env("BAT_CONFIG_PATH", "not-existing.conf")
|
||||
.arg("--config-file")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("not-existing.conf\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_location_when_generating() {
|
||||
let tmp_dir = tempdir().expect("can create temporary directory");
|
||||
let tmp_config_path = tmp_dir.path().join("should-be-created.conf");
|
||||
|
||||
// Create the file with bat
|
||||
bat_with_config()
|
||||
.env("BAT_CONFIG_PATH", tmp_config_path.to_str().unwrap())
|
||||
.arg("--generate-config-file")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
predicate::str::is_match("Success! Config file written to .*should-be-created.conf\n")
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
// Now we expect the file to exist. If it exists, we assume contents are correct
|
||||
assert!(tmp_config_path.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -771,9 +1029,7 @@ fn file_with_invalid_utf8_filename() {
|
||||
use std::io::Write;
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
|
||||
use tempdir::TempDir;
|
||||
|
||||
let tmp_dir = TempDir::new("bat_test").expect("can create temporary directory");
|
||||
let tmp_dir = tempdir().expect("can create temporary directory");
|
||||
let file_path = tmp_dir
|
||||
.path()
|
||||
.join(OsStr::from_bytes(b"test-invalid-utf8-\xC3(.rs"));
|
||||
@@ -844,3 +1100,41 @@ fn show_all_mode() {
|
||||
.stdout("hello·world␊\n├──┤␍␀␇␈␛")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plain_mode_does_not_add_nonexisting_newline() {
|
||||
bat()
|
||||
.arg("--paging=never")
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=plain")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/sharkdp/bat/issues/299
|
||||
#[test]
|
||||
fn grid_for_file_without_newline() {
|
||||
bat()
|
||||
.arg("--paging=never")
|
||||
.arg("--color=never")
|
||||
.arg("--terminal-width=80")
|
||||
.arg("--wrap=never")
|
||||
.arg("--decorations=always")
|
||||
.arg("--style=full")
|
||||
.arg("single-line.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(
|
||||
"\
|
||||
───────┬────────────────────────────────────────────────────────────────────────
|
||||
│ File: single-line.txt
|
||||
───────┼────────────────────────────────────────────────────────────────────────
|
||||
1 │ Single Line
|
||||
───────┴────────────────────────────────────────────────────────────────────────
|
||||
",
|
||||
)
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
echo I am more
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
ECHO I am more
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
echo I am most
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
ECHO I am most
|
||||
@@ -17,6 +17,9 @@ fn no_duplicate_extensions() {
|
||||
// The '.fs' extension appears in F# and GLSL.
|
||||
// We default to F#.
|
||||
"fs",
|
||||
// SystemVerilog and Verilog both use .v files.
|
||||
// We default to Verilog.
|
||||
"v",
|
||||
];
|
||||
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
@@ -7,7 +7,7 @@ macro_rules! snapshot_tests {
|
||||
$(
|
||||
#[test]
|
||||
fn $test_name() {
|
||||
let bat_tester = BatTester::new();
|
||||
let bat_tester = BatTester::default();
|
||||
bat_tester.test_snapshot(stringify!($test_name), $style);
|
||||
}
|
||||
)*
|
||||
|
||||
+4
-2
@@ -12,7 +12,7 @@ BAT_OPTIONS = [
|
||||
"--no-config",
|
||||
"--style=plain",
|
||||
"--color=always",
|
||||
"--theme='1337'",
|
||||
"--theme=default",
|
||||
"--italic-text=always",
|
||||
]
|
||||
|
||||
@@ -41,7 +41,9 @@ def create_highlighted_versions(output_basepath):
|
||||
root = os.path.dirname(os.path.abspath(__file__))
|
||||
sources = path.join(root, "source", "*")
|
||||
|
||||
for source in glob.glob(path.join(sources, "*")) + glob.glob(path.join(sources, ".*")):
|
||||
for source in glob.glob(path.join(sources, "*")) + glob.glob(
|
||||
path.join(sources, ".*")
|
||||
):
|
||||
try:
|
||||
env = os.environ.copy()
|
||||
env.pop("PAGER", None)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[3;38;2;102;217;239mfirst[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mlast[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239maddress[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mcity[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mzip[0m
|
||||
[3;38;2;102;217;239mJohn[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mDoe[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;102;217;239ma[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mb[0m
|
||||
[38;2;190;132;255m1[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;248;248;242m [0m
|
||||
[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m
|
||||
[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[38;2;190;132;255m3[0m[38;2;249;38;114m,[0m[38;2;190;132;255m4[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;166;226;46mfirst[0m[38;2;253;151;31m,[0m[38;2;102;217;239mlast[0m[38;2;253;151;31m,[0m[38;2;190;132;255maddress[0m[38;2;253;151;31m,[0m[38;2;249;38;114mcity[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46mzip[0m
|
||||
[3;38;2;166;226;46mJohn[0m[38;2;253;151;31m,[0m[38;2;102;217;239mDoe[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46ma[0m[38;2;253;151;31m,[0m[38;2;102;217;239mb[0m
|
||||
[3;38;2;166;226;46m1[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mha [0m
|
||||
[38;2;190;132;255m""[0m[38;2;230;219;116mha[0m[38;2;190;132;255m""[0m[38;2;230;219;116m [0m
|
||||
[38;2;230;219;116mha[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46m3[0m[38;2;253;151;31m,[0m[38;2;102;217;239m4[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 276.
|
@@ -1,29 +1,29 @@
|
||||
[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;116mname[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;116mjohn[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;116mage[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m42[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116misCustomer[0m[38;2;230;219;116m"[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;230;219;116m"[0m[38;2;230;219;116mchildren[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;253;151;31m"[0m[38;2;253;151;31mname[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mjohn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mage[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m42[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31misCustomer[0m[38;2;253;151;31m"[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;253;151;31m"[0m[38;2;253;151;31mchildren[0m[38;2;253;151;31m"[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;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mname[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;116mjames[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;116mage[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m35[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116misCustomer[0m[38;2;230;219;116m"[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;230;219;116m"[0m[38;2;230;219;116mchildren[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;253;151;31m"[0m[38;2;253;151;31mname[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mjames[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mage[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m35[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31misCustomer[0m[38;2;253;151;31m"[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;253;151;31m"[0m[38;2;253;151;31mchildren[0m[38;2;253;151;31m"[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;230;219;116m"[0m[38;2;230;219;116mname[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;116mlinus[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;116mage[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m4[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mname[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mlinus[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mage[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m4[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;230;219;116m"[0m[38;2;230;219;116mname[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;116msandra[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;116mage[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mname[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116msandra[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mage[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[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;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mname[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;116mjessica[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;116mage[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116misCustomer[0m[38;2;230;219;116m"[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;230;219;116m"[0m[38;2;230;219;116mchildren[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;253;151;31m"[0m[38;2;253;151;31mname[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mjessica[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31mage[0m[38;2;253;151;31m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;253;151;31m"[0m[38;2;253;151;31misCustomer[0m[38;2;253;151;31m"[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;253;151;31m"[0m[38;2;253;151;31mchildren[0m[38;2;253;151;31m"[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,68 @@
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m data.matrix.notation[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m data.vector2[0m
|
||||
|
||||
[38;2;117;113;94m/-![0m
|
||||
|
||||
[38;2;117;113;94mHelpers that don't currently fit elsewhere...[0m
|
||||
|
||||
[38;2;117;113;94m-/[0m
|
||||
|
||||
[38;2;249;38;114mlemma[0m[38;2;248;248;242m [0m[38;2;166;226;46msplit_eq[0m[38;2;248;248;242m [0m[38;2;248;248;242m{m n : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*} (x : m × n) (p p' : m × n) :[0m
|
||||
[38;2;248;248;242m p = x ∨ p' = x ∨ (x ≠ p ∧ x ≠ p') := [0m[38;2;249;38;114mby[0m[38;2;248;248;242m tauto[0m
|
||||
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m For `playfield`s, the piece type and/or piece index type.[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m (X : [0m[3;38;2;102;217;239mType[0m[38;2;248;248;242m*)[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m [has_repr X][0m
|
||||
|
||||
[38;2;249;38;114mnamespace[0m[38;2;248;248;242m chess.utils[0m
|
||||
|
||||
[38;2;249;38;114msection[0m[38;2;248;248;242m repr[0m
|
||||
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mAn auxiliary wrapper for `option X` that allows for overriding the `has_repr` instance[0m
|
||||
[38;2;117;113;94mfor `option`, and rather, output just the value in the `some` and a custom provided[0m
|
||||
[38;2;117;113;94m`string` for `none`.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mstructure[0m[38;2;248;248;242m [0m[38;2;166;226;46moption_wrapper[0m[38;2;248;248;242m [0m[38;2;248;248;242m:=[0m
|
||||
[38;2;248;248;242m(val : option X)[0m
|
||||
[38;2;248;248;242m(none_s : string)[0m
|
||||
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mwrapped_option_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: has_repr (option_wrapper X) :=[0m
|
||||
[38;2;248;248;242m⟨[0m[38;2;249;38;114mλ[0m[38;2;248;248;242m ⟨val, s⟩, (option.map has_repr.repr val).get_or_else s⟩[0m
|
||||
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m {X}[0m
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mConstruct an `option_wrapper` term from a provided `option X` and the `string`[0m
|
||||
[38;2;117;113;94mthat will override the `has_repr.repr` for `none`.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46moption_wrap[0m[38;2;248;248;242m [0m[38;2;248;248;242m(val : option X) (none_s : string) : option_wrapper X := ⟨val, none_s⟩[0m
|
||||
|
||||
[38;2;117;113;94m--[0m[38;2;117;113;94m The size of the "vectors" for a `fin n' → X`, for `has_repr` definitions[0m
|
||||
[38;2;249;38;114mvariables[0m[38;2;248;248;242m {m' n' : ℕ}[0m
|
||||
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mFor a "vector" `X^n'` represented by the type `Π n' : ℕ, fin n' → X`, where[0m
|
||||
[38;2;117;113;94mthe `X` has a `has_repr` instance itself, we can provide a `has_repr` for the "vector".[0m
|
||||
[38;2;117;113;94mThis definition is used for displaying rows of the playfield, when it is defined[0m
|
||||
[38;2;117;113;94mvia a `matrix`, likely through notation.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mvec_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: Π {n' : ℕ}, (fin n' → X) → string :=[0m
|
||||
[38;2;249;38;114mλ[0m[38;2;248;248;242m _ v, string.intercalate [0m[38;2;230;219;116m"[0m[38;2;230;219;116m, [0m[38;2;230;219;116m"[0m[38;2;248;248;242m ((vector.of_fn v).to_list.map repr)[0m
|
||||
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mvec_repr_instance[0m[38;2;248;248;242m [0m[38;2;248;248;242m: has_repr (fin n' → X) := ⟨vec_repr⟩[0m
|
||||
|
||||
[38;2;117;113;94m/--[0m
|
||||
[38;2;117;113;94mFor a `matrix` `X^(m' × n')` where the `X` has a `has_repr` instance itself,[0m
|
||||
[38;2;117;113;94mwe can provide a `has_repr` for the matrix, using `vec_repr` for each of the rows of the matrix.[0m
|
||||
[38;2;117;113;94mThis definition is used for displaying the playfield, when it is defined[0m
|
||||
[38;2;117;113;94mvia a `matrix`, likely through notation.[0m
|
||||
[38;2;117;113;94m-/[0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mmatrix_repr[0m[38;2;248;248;242m [0m[38;2;248;248;242m: Π {m' n'}, matrix (fin m') (fin n') X → string :=[0m
|
||||
[38;2;249;38;114mλ[0m[38;2;248;248;242m _ _ M, string.intercalate [0m[38;2;230;219;116m"[0m[38;2;230;219;116m;[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m[38;2;248;248;242m ((vector.of_fn M).to_list.map repr)[0m
|
||||
|
||||
[38;2;249;38;114minstance[0m[38;2;248;248;242m [0m[38;2;166;226;46mmatrix_repr_instance[0m[38;2;248;248;242m [0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m has_repr (matrix (fin n') (fin m') X) := ⟨matrix_repr⟩[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m repr[0m
|
||||
|
||||
[38;2;249;38;114mend[0m[38;2;248;248;242m chess.utils[0m
|
||||
@@ -0,0 +1,2 @@
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;190;132;255m.[0m[38;2;190;132;255m392[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46m[[0m[4;38;2;190;132;255m2001[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255mdb8[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m4006[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m812[0m[4;38;2;166;226;46m:[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m200e[0m[4;38;2;166;226;46m][0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46mexample.com[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m(with_parens)[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
@@ -175,4 +175,4 @@
|
||||
[38;2;117;113;94m\u{ad}[0m[38;2;249;38;114m␊[0m
|
||||
[38;2;117;113;94m\u{ae}[0m[38;2;249;38;114m␊[0m
|
||||
[38;2;249;38;114m␊[0m
|
||||
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m
|
||||
[38;2;248;248;242mHere's[0m[38;2;102;217;239m·[0m[38;2;248;248;242ma[0m[38;2;102;217;239m·[0m[38;2;248;248;242mline[0m[38;2;102;217;239m·[0m[38;2;248;248;242mwith[0m[38;2;102;217;239m·[0m[38;2;248;248;242mmultiple[0m[38;2;102;217;239m·[0m[38;2;248;248;242mcharacters.[0m[38;2;249;38;114m␊[0m
|
||||
|
||||
@@ -0,0 +1,376 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m SPDX-License-Identifier: MIT[0m
|
||||
|
||||
[38;2;249;38;114mpragma[0m[38;2;248;248;242m [0m[38;2;249;38;114msolidity[0m[38;2;248;248;242m [0m[38;2;249;38;114m^[0m[38;2;190;132;255m0[0m[38;2;190;132;255m.8.0[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mi[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mM[0m[38;2;230;219;116me[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mA[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[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;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mt[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[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;116mn[0m[38;2;230;219;116mg[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116ms[0m[38;2;230;219;116mp[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116m/[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m1[0m[38;2;230;219;116m6[0m[38;2;230;219;116m5[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including[0m
|
||||
[38;2;117;113;94m * the Metadata extension, but not including the Enumerable extension, which is available separately as[0m
|
||||
[38;2;117;113;94m * {ERC721Enumerable}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;249;38;114mcontract[0m[38;2;248;248;242m [0m[4;38;2;102;217;239mERC721[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mContext[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mERC165[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mIERC721[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mIERC721Metadata[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114musing[0m[38;2;248;248;242m Address [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114musing[0m[38;2;248;248;242m Strings [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Token name[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate [0m[38;2;248;248;242m_name[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Token symbol[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate [0m[38;2;248;248;242m_symbol[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from token ID to owner address[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _owners;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping owner address to token count[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _balances;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from token ID to approved address[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _tokenApprovals;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from owner to operator approvals[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _operatorApprovals;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mconstructor[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m name_[0m[38;2;248;248;242m, [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m symbol_[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_name[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m name_;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m_symbol[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m symbol_;[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 * @dev See {IERC165-supportsInterface}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msupportsInterface[0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes4[0m[38;2;248;248;242m [0m[3;38;2;253;151;31minterfaceId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m(ERC165, IERC165) [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[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;114mreturn[0m[38;2;248;248;242m interfaceId [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mtype[0m[38;2;248;248;242m([0m[38;2;248;248;242mIERC721[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.interfaceId[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m interfaceId [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mtype[0m[38;2;248;248;242m([0m[38;2;248;248;242mIERC721Metadata[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.interfaceId[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;249;38;114msuper[0m[38;2;248;248;242m.[0m[38;2;102;217;239msupportsInterface[0m[38;2;248;248;242m([0m[38;2;248;248;242minterfaceId[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 * @dev See {IERC721-balanceOf}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mbalanceOf[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mowner[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[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;114mrequire[0m[38;2;248;248;242m(owner [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mb[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[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;114mreturn[0m[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[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 * @dev See {IERC721-ownerOf}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mownerOf[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[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;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(owner [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[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;114mreturn[0m[38;2;248;248;242m owner;[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 * @dev See {IERC721Metadata-name}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mname[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[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;114mreturn[0m[38;2;248;248;242m _name;[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 * @dev See {IERC721Metadata-symbol}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msymbol[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[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;114mreturn[0m[38;2;248;248;242m _symbol;[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 * @dev See {IERC721Metadata-tokenURI}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mtokenURI[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[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;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mM[0m[38;2;230;219;116me[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mU[0m[38;2;230;219;116mR[0m[38;2;230;219;116mI[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[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;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory [0m[38;2;248;248;242mbaseURI[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239m_baseURI[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;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m([0m[38;2;248;248;242mbaseURI[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[3;38;2;166;226;46mlength[0m[38;2;248;248;242m [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m([0m[38;2;102;217;239mabi.encodePacked[0m[38;2;248;248;242m(baseURI, [0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m.[0m[38;2;102;217;239mtoString[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;230;219;116m'[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;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden[0m
|
||||
[38;2;117;113;94m * in child contracts.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_baseURI[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[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;114mreturn[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[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;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-approve}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mapprove[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m owner, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116mu[0m[38;2;230;219;116mr[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[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;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[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 owner [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;102;217;239m_msgSender[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;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[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;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId[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 * @dev See {IERC721-getApproved}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mgetApproved[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[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;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[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;114mreturn[0m[38;2;248;248;242m _tokenApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[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 * @dev See {IERC721-setApprovalForAll}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msetApprovalForAll[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperator[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbool[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mapproved[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(operator [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;102;217;239m_msgSender[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;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _operatorApprovals[0m[38;2;248;248;242m[[0m[38;2;102;217;239m_msgSender[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;242moperator[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m approved;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mApprovalForAll[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, operator, approved[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 * @dev See {IERC721-isApprovedForAll}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mowner[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperator[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[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;114mreturn[0m[38;2;248;248;242m _operatorApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[0m[38;2;248;248;242m][0m[38;2;248;248;242m[[0m[38;2;248;248;242moperator[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 * @dev See {IERC721-transferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mtransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[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;94msolhint-disable-next-line max-line-length[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[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;102;217;239m_transfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[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 * @dev See {IERC721-safeTransferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, [0m[38;2;230;219;116m"[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 * @dev See {IERC721-safeTransferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[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;102;217;239m_safeTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, _data[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 * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients[0m
|
||||
[38;2;117;113;94m * are aware of the ERC721 protocol to prevent tokens from being forever locked.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * `_data` is additional data, it has no specified format and it is sent in call to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.[0m
|
||||
[38;2;117;113;94m * implement alternative mechanisms to perform token transfer, such as signature-based.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `from` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `tokenId` token must exist and be owned by `from`.[0m
|
||||
[38;2;117;113;94m * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_transfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[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 * @dev Returns whether `tokenId` exists.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Tokens start existing when they are minted (`_mint`),[0m
|
||||
[38;2;117;113;94m * and stop existing when they are burned (`_burn`).[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_exists[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[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;114mreturn[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[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;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[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 * @dev Returns whether `spender` is allowed to manage `tokenId`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must exist.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mspender[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[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;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mp[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[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;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mspender [0m[38;2;249;38;114m==[0m[38;2;248;248;242m owner [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239mgetApproved[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m spender [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, spender[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 * @dev Safely mints `tokenId` and transfers it to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must not exist.[0m
|
||||
[38;2;117;113;94m * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeMint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_safeMint[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId, [0m[38;2;230;219;116m"[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 * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is[0m
|
||||
[38;2;117;113;94m * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeMint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_mint[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[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 * @dev Mints `tokenId` and transfers it to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must not exist.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_mint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mm[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[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;114mrequire[0m[38;2;248;248;242m([0m[38;2;249;38;114m![0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mm[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116md[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;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mto[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;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[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 * @dev Destroys `tokenId`.[0m
|
||||
[38;2;117;113;94m * The approval is cleared when the token is burned.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must exist.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_burn[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[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 Clear approvals[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[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;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdelete[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[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 * @dev Transfers `tokenId` from `from` to `to`.[0m
|
||||
[38;2;117;113;94m * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `tokenId` token must be owned by `from`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_transfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m from, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mf[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[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;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[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;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[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 Clear approvals from the previous owner[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfrom[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;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mto[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;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[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 * @dev Approve `to` to operate on `tokenId`[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Approval} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m _tokenApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mApproval[0m[38;2;248;248;242m([0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[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 * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.[0m
|
||||
[38;2;117;113;94m * The call is not executed if the target address is not a contract.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * @param from address representing the previous owner of the given token ID[0m
|
||||
[38;2;117;113;94m * @param to target address that will receive the tokens[0m
|
||||
[38;2;117;113;94m * @param tokenId uint256 ID of the token to be transferred[0m
|
||||
[38;2;117;113;94m * @param _data bytes optional data to send along with the call[0m
|
||||
[38;2;117;113;94m * @return bool whether the call correctly returned the expected magic value[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[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[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m.[0m[38;2;102;217;239misContract[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;114mtry[0m[38;2;248;248;242m [0m[38;2;102;217;239mIERC721Receiver[0m[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239monERC721Received[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, from, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes4[0m[38;2;248;248;242m [0m[38;2;248;248;242mretval[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;114mreturn[0m[38;2;248;248;242m retval [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mIERC721Receiver[0m[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.onERC721Received.[0m[38;2;249;38;114mselector[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;114mcatch[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m reason[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[38;2;248;248;242m([0m[38;2;248;248;242mreason.[0m[3;38;2;166;226;46mlength[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m 0[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;114mrevert[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[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;114melse[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 solhint-disable-next-line no-inline-assembly[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239massembly[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mrevert[0m[38;2;248;248;242m([0m[38;2;102;217;239madd[0m[38;2;248;248;242m([0m[38;2;190;132;255m32[0m[38;2;248;248;242m, reason), [0m[38;2;102;217;239mmload[0m[38;2;248;248;242m(reason))[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;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[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 * @dev Hook that is called before any token transfer. This includes minting[0m
|
||||
[38;2;117;113;94m * and burning.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Calling conditions:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be[0m
|
||||
[38;2;117;113;94m * transferred to `to`.[0m
|
||||
[38;2;117;113;94m * - When `from` is zero, `tokenId` will be minted for `to`.[0m
|
||||
[38;2;117;113;94m * - When `to` is zero, ``from``'s `tokenId` will be burned.[0m
|
||||
[38;2;117;113;94m * - `from` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[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,11 @@
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[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;248;248;242m logrotate.service: Succeeded.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[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;248;248;242m Finished Rotate log files.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mcolord[0m[38;2;248;248;242m[[0m[38;2;190;132;255m920[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;240mfailed[0m[38;2;248;248;242m to get session [pid [0m[38;2;190;132;255m137485[0m[38;2;248;248;242m]: No data available[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mkernel[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31m55604[0m[38;2;248;248;242m.[0m[3;38;2;253;151;31m908232[0m[38;2;248;248;242m][0m[38;2;248;248;242m audit: [0m[3;38;2;253;151;31mtype[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1400[0m[38;2;248;248;242m audit([0m[38;2;190;132;255m1617483621[0m[38;2;190;132;255m.[0m[38;2;190;132;255m094[0m[38;2;248;248;242m:[0m[38;2;190;132;255m28[0m[38;2;248;248;242m): [0m[3;38;2;253;151;31mapparmor[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mDENIED[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperation[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcapable[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mprofile[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116m/usr/sbin/cups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m59311[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcomm[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapability[0m[38;2;249;38;114m=[0m[38;2;190;132;255m23[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapname[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116msys_nice[0m[38;2;230;219;116m"[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:01:38[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd-resolved[0m[38;2;248;248;242m[[0m[38;2;190;132;255m721[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Server returned [0m[38;2;248;248;240merror[0m[38;2;248;248;242m NXDOMAIN, mitigating potential DNS violation DVE-[0m[38;2;190;132;255m2018[0m[38;2;248;248;242m-[0m[38;2;190;132;255m0001[0m[38;2;248;248;242m, retrying transaction with reduced feature level UDP.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:04:46[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Soliciting pool server [0m[38;2;190;132;255m255[0m[38;2;248;248;242m.[0m[38;2;190;132;255m76[0m[38;2;248;248;242m.[0m[38;2;190;132;255m59[0m[38;2;248;248;242m.[0m[38;2;190;132;255m37[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:05:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[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;190;132;255m1[0m[38;2;248;248;242m local addr [0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m -> [0m[38;2;190;132;255m<null>[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:06:29[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m receive: Unexpected origin timestamp [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d1[0m[38;2;190;132;255m.[0m[38;2;190;132;255m82e825f5[0m[38;2;248;248;242m does not match aorg [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d5[0m[38;2;190;132;255m.[0m[38;2;190;132;255m82c50d8c[0m[38;2;248;248;242m from server@[0m[38;2;190;132;255m127[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;190;132;255m1[0m[38;2;248;248;242m xmt [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d1[0m[38;2;190;132;255m.[0m[38;2;190;132;255me671d7c4[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m09:30:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mCRON[0m[38;2;248;248;242m[[0m[38;2;190;132;255m89278[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m (root) [0m[38;2;166;226;46mCMD[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;102;217;239m[[0m[38;2;255;255;255m [0m[3;38;2;253;151;31m-[0m[3;38;2;253;151;31mx[0m[38;2;255;255;255m /etc/init.d/anacron [0m[38;2;102;217;239m][0m[38;2;255;255;255m [0m[38;2;249;38;114m&&[0m[38;2;255;255;255m [0m[38;2;249;38;114mif[0m[38;2;255;255;255m [0m[38;2;102;217;239m[[0m[38;2;255;255;255m [0m[38;2;249;38;114m![0m[38;2;255;255;255m [0m[3;38;2;253;151;31m-[0m[3;38;2;253;151;31md[0m[38;2;255;255;255m /run/systemd/system [0m[38;2;102;217;239m][0m[38;2;249;38;114m;[0m[38;2;255;255;255m [0m[38;2;249;38;114mthen[0m[38;2;255;255;255m [0m[38;2;255;255;255m/usr/sbin/invoke-rc.d[0m[38;2;255;255;255m anacron start [0m[38;2;249;38;114m>[0m[38;2;255;255;255m/dev/null[0m[38;2;249;38;114m;[0m[38;2;255;255;255m [0m[38;2;249;38;114mfi[0m[38;2;248;248;242m)[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m16:32:07[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mNetworkManager[0m[38;2;248;248;242m[[0m[38;2;190;132;255m740[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m<info>[0m[38;2;248;248;242m [[0m[38;2;190;132;255m1617629527[0m[38;2;190;132;255m.[0m[38;2;190;132;255m1101[0m[38;2;248;248;242m] manager: NetworkManager state is now CONNECTED_GLOBAL[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m22:00:45[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mdbus-daemon[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1094[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;253;151;31msession[0m[38;2;248;248;242m [0m[3;38;2;253;151;31muid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1000[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1094[0m[38;2;248;248;242m][0m[38;2;248;248;242m Successfully activated service [0m[38;2;230;219;116m'[0m[38;2;230;219;116mio.github.celluloid_player.Celluloid[0m[38;2;230;219;116m'[0m
|
||||
@@ -0,0 +1,103 @@
|
||||
[38;2;190;132;255m`timescale[0m[38;2;248;248;242m [0m[38;2;190;132;255m1ns[0m[38;2;249;38;114m/[0m[38;2;190;132;255m1ps[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Design Code[0m
|
||||
[38;2;249;38;114mmodule[0m[38;2;248;248;242m [0m[38;2;166;226;46mADDER[0m[38;2;248;248;242m([0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m clk,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] a,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] b,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m bIsPos,[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46moutput[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mreg[0m[38;2;248;248;242m [[0m[38;2;190;132;255m8[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] result[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114malways[0m[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;248;248;242m ([0m[38;2;249;38;114mposedge[0m[38;2;248;248;242m clk) [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (bIsPos) [0m[38;2;249;38;114mbegin[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114m+[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114m-[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
|
||||
[38;2;249;38;114mendmodule[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mADDER[0m
|
||||
|
||||
[38;2;249;38;114minterface[0m[38;2;248;248;242m [0m[38;2;166;226;46madder_if[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46minput[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mbit[0m[38;2;248;248;242m clk,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] a,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] b,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m bIsPos,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m8[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] result[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mclocking[0m[38;2;248;248;242m cb [0m[38;2;249;38;114m@[0m[38;2;248;248;242m([0m[38;2;249;38;114mposedge[0m[38;2;248;248;242m clk);[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m a;[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m b;[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m bIsPos;[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m result;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendclocking[0m[38;2;248;248;242m [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mcb[0m
|
||||
|
||||
[38;2;249;38;114mendinterface[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46madder_if[0m
|
||||
|
||||
|
||||
[38;2;249;38;114mbind[0m[38;2;248;248;242m ADDER [0m[3;38;2;102;217;239madder_if[0m[38;2;248;248;242m [0m[38;2;166;226;46mmy_adder_if[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mclk[0m[38;2;248;248;242m(clk),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239ma[0m[38;2;248;248;242m(a),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mb[0m[38;2;248;248;242m(b),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mbIsPos[0m[38;2;248;248;242m(bIsPos),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mresult[0m[38;2;248;248;242m(result)[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Testbench Code[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[3;38;2;166;226;46muvm_pkg[0m[38;2;249;38;114m::[0m[38;2;249;38;114m*[0m[38;2;248;248;242m;[0m
|
||||
[38;2;190;132;255m`include[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116muvm_macros.svh[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mtestbench_env[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[3;4;38;2;166;226;46muvm_env[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mvirtual [0m[3;38;2;102;217;239madder_if[0m[38;2;248;248;242m [0m[38;2;248;248;242mm_if;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mnew[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mstring[0m[38;2;248;248;242m name, [0m[3;38;2;102;217;239muvm_component[0m[38;2;248;248;242m parent [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mnull[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msuper[0m[38;2;248;248;242m.[0m[38;2;249;38;114mnew[0m[38;2;248;248;242m(name, parent);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfunction[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[3;38;2;102;217;239m void[0m[38;2;248;248;242m [0m[38;2;166;226;46mconnect_phase[0m[38;2;248;248;242m([0m[3;38;2;102;217;239muvm_phase[0m[38;2;248;248;242m phase[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m(uvm_resource_db[0m[38;2;249;38;114m#[0m[38;2;248;248;242m([0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m adder_if)[0m[38;2;249;38;114m:[0m[38;2;249;38;114m:[0m[38;2;102;217;239mread_by_name[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_full_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116madder_if[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, m_if));[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfunction[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mconnect_phase[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtask[0m[38;2;248;248;242m [0m[38;2;166;226;46mrun_phase[0m[38;2;248;248;242m([0m[3;38;2;102;217;239muvm_phase[0m[38;2;248;248;242m phase[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m phase.[0m[38;2;102;217;239mraise_objection[0m[38;2;248;248;242m([0m[38;2;249;38;114mthis[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116mStarting test![0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;190;132;255mUVM_HIGH[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[3;38;2;102;217;239m int[0m[38;2;248;248;242m a [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8'h4[0m[38;2;248;248;242m, b [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8'h5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;248;248;242m(m_if.cb);[0m
|
||||
[38;2;248;248;242m m_if.cb.a [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a;[0m
|
||||
[38;2;248;248;242m m_if.cb.b [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m m_if.cb.bIsPos [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1'b1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrepeat[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m) [0m[38;2;249;38;114m@[0m[38;2;248;248;242m(m_if.cb);[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;102;217;239m$sformatf[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m + [0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m = [0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, a, b, m_if.cb.result), [0m[38;2;190;132;255mUVM_LOW[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116mEnding test![0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;190;132;255mUVM_HIGH[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m phase.[0m[38;2;102;217;239mdrop_objection[0m[38;2;248;248;242m([0m[38;2;249;38;114mthis[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendtask[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mrun_phase[0m
|
||||
[38;2;249;38;114mendclass[0m
|
||||
|
||||
|
||||
[38;2;249;38;114mmodule[0m[38;2;248;248;242m [0m[38;2;166;226;46mtop[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[3;38;2;102;217;239m bit[0m[38;2;248;248;242m clk;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239menv[0m[38;2;248;248;242m [0m[38;2;248;248;242menvironment;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mADDER[0m[38;2;248;248;242m [0m[38;2;166;226;46mdut[0m[38;2;248;248;242m(.[0m[38;2;102;217;239mclk[0m[38;2;248;248;242m (clk));[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minitial[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242menvironment [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mtestbench_env[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239muvm_resource_db[0m[38;2;249;38;114m#[0m[38;2;248;248;242m([0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m adder_if)[0m[38;2;249;38;114m:[0m[38;2;249;38;114m:[0m[38;2;102;217;239mset[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116menv[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116madder_if[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, dut.my_adder_if);[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mclk [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mrun_test[0m[38;2;248;248;242m();[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Clock generation [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minitial[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mforever[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[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) clk [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m~[0m[38;2;248;248;242mclk;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;249;38;114mendmodule[0m
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user