on master help sign in
Merge remote-tracking branch 'origin/master' into fix-1063
02e6ff4Martin Nordholts
.github/workflows/CICD.yml+35−48
@@ -2,17 +2,18 @@ name: CICD
2
2
3env:
3env:
4 PROJECT_NAME: bat
4 PROJECT_NAME: bat
5+ PROJECT_VERSION: "0.17.1"
5 PROJECT_DESC: "A `cat` clone with wings"
6 PROJECT_DESC: "A `cat` clone with wings"
6 PROJECT_MAINTAINER: "David Peter <mail@david-peter.de>"
7 PROJECT_MAINTAINER: "David Peter <mail@david-peter.de>"
7 PROJECT_HOMEPAGE: "https://github.com/sharkdp/bat"
8 PROJECT_HOMEPAGE: "https://github.com/sharkdp/bat"
8− MIN_SUPPORTED_RUST_VERSION: "1.40.0"
9+ MIN_SUPPORTED_RUST_VERSION: "1.42.0"
9
10
10on: [push, pull_request]
11on: [push, pull_request]
11
12
12jobs:
13jobs:
13 min_version:
14 min_version:
14 name: Minimum supported rust version
15 name: Minimum supported rust version
15− runs-on: ubuntu-latest
16+ runs-on: ubuntu-18.04
16 steps:
17 steps:
17 - name: Git checkout
18 - name: Git checkout
18 uses: actions/checkout@v2
19 uses: actions/checkout@v2
@@ -27,7 +28,7 @@ jobs:
27 uses: actions-rs/cargo@v1
28 uses: actions-rs/cargo@v1
28 with:
29 with:
29 command: clippy
30 command: clippy
30− args: --all-targets --all-features -- --allow clippy::style
31+ args: --all-targets --all-features
31 - name: Test
32 - name: Test
32 uses: actions-rs/cargo@v1
33 uses: actions-rs/cargo@v1
33 with:
34 with:
@@ -35,7 +36,7 @@ jobs:
35
36
36 test_with_new_syntaxes_and_themes:
37 test_with_new_syntaxes_and_themes:
37 name: Test with new syntaxes and themes
38 name: Test with new syntaxes and themes
38− runs-on: ubuntu-latest
39+ runs-on: ubuntu-18.04
39 steps:
40 steps:
40 - name: Git checkout
41 - name: Git checkout
41 uses: actions/checkout@v2
42 uses: actions/checkout@v2
@@ -83,19 +84,17 @@ jobs:
83 fail-fast: false
84 fail-fast: false
84 matrix:
85 matrix:
85 job:
86 job:
86− # { os, target, cargo-options, features, use-cross }
87− - { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , use-cross: true }
87+ - { os: ubuntu-18.04 , target: arm-unknown-linux-gnueabihf , use-cross: true }
88− - { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: true }
88+ - { os: ubuntu-18.04 , target: aarch64-unknown-linux-gnu , use-cross: true }
89− - { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: true }
89+ - { os: ubuntu-18.04 , target: i686-unknown-linux-gnu , use-cross: true }
90− - { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: true }
90+ - { os: ubuntu-18.04 , target: i686-unknown-linux-musl , use-cross: true }
91− - { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu }
91+ - { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu }
92− - { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: true }
92+ - { os: ubuntu-18.04 , target: x86_64-unknown-linux-musl , use-cross: true }
93− - { os: ubuntu-16.04 , target: x86_64-unknown-linux-gnu }
94− - { os: macos-latest , target: x86_64-apple-darwin }
93+ - { os: macos-10.15 , target: x86_64-apple-darwin }
95− # - { os: windows-latest , target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
94+ # - { os: windows-2019 , target: i686-pc-windows-gnu } ## disabled; error: linker `i686-w64-mingw32-gcc` not found
96− - { os: windows-latest , target: i686-pc-windows-msvc }
95+ - { os: windows-2019 , target: i686-pc-windows-msvc }
97− - { os: windows-latest , target: x86_64-pc-windows-gnu }
96+ - { os: windows-2019 , target: x86_64-pc-windows-gnu }
98− - { os: windows-latest , target: x86_64-pc-windows-msvc }
97+ - { os: windows-2019 , target: x86_64-pc-windows-msvc }
99 steps:
98 steps:
100 - name: Git checkout
99 - name: Git checkout
101 uses: actions/checkout@v2
100 uses: actions/checkout@v2
@@ -116,26 +115,14 @@ jobs:
116 # determine EXE suffix
115 # determine EXE suffix
117 EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
116 EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac;
118 echo ::set-output name=EXE_suffix::${EXE_suffix}
117 echo ::set-output name=EXE_suffix::${EXE_suffix}
119− # parse commit reference info
120− unset REF_TAG ; case ${GITHUB_REF} in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac;
121− REF_SHAS=${GITHUB_SHA:0:8}
122− # parse target
123− 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;
124− echo ::set-output name=TARGET_ARCH::${TARGET_ARCH}
125− unset TARGET_OS ; case ${{ matrix.job.target }} in *-linux-*) TARGET_OS=linux ;; *-apple-*) TARGET_OS=macos ;; *-windows-*) TARGET_OS=windows ;; esac;
126− echo ::set-output name=TARGET_OS::${TARGET_OS}
127 # package name
118 # package name
128 PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
119 PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
129− PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }}
120+ PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }}
130 PKG_NAME=${PKG_BASENAME}${PKG_suffix}
121 PKG_NAME=${PKG_BASENAME}${PKG_suffix}
131− echo ::set-output name=PKG_suffix::${PKG_suffix}
132 echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
122 echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
133 echo ::set-output name=PKG_NAME::${PKG_NAME}
123 echo ::set-output name=PKG_NAME::${PKG_NAME}
134− # deployable tag? (ie, leading "vM" or "M"; M == version number)
124+ unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
135− unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi
136− # unset deploy on ubuntu-18.04 x64 - we will deploy the tarball/deb built on ubuntu-16.04 x64
137− if [ "${{ matrix.job.os }}" = "ubuntu-18.04" ] && [ "${{ matrix.job.target }}" = "x86_64-unknown-linux-gnu" ]; then unset DEPLOY; fi
138− echo ::set-output name=DEPLOY::${DEPLOY}
125+ echo ::set-output name=IS_RELEASE::${IS_RELEASE}
139 # DPKG architecture?
126 # DPKG architecture?
140 unset DPKG_ARCH
127 unset DPKG_ARCH
141 case ${{ matrix.job.target }} in
128 case ${{ matrix.job.target }} in
@@ -145,8 +132,7 @@ jobs:
145 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
132 x86_64-*-linux-*) DPKG_ARCH=amd64 ;;
146 esac;
133 esac;
147 echo ::set-output name=DPKG_ARCH::${DPKG_ARCH}
134 echo ::set-output name=DPKG_ARCH::${DPKG_ARCH}
148− # DPKG version?
135+ DPKG_VERSION=${PROJECT_VERSION}
149− unset DPKG_VERSION ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DPKG_VERSION=${REF_TAG/#[vV]/} ; fi
150 echo ::set-output name=DPKG_VERSION::${DPKG_VERSION}
136 echo ::set-output name=DPKG_VERSION::${DPKG_VERSION}
151 # DPKG base name/conflicts?
137 # DPKG base name/conflicts?
152 DPKG_BASENAME=${PROJECT_NAME}
138 DPKG_BASENAME=${PROJECT_NAME}
@@ -159,10 +145,6 @@ jobs:
159 if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi
145 if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi
160 echo ::set-output name=DPKG_NAME::${DPKG_NAME}
146 echo ::set-output name=DPKG_NAME::${DPKG_NAME}
161 # target-specific options
147 # target-specific options
162− # # * `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)
163− JOB_DO_TESTING="true"
164− case ${{ matrix.job.target }} in arm-*) unset JOB_DO_TESTING ;; esac;
165− echo ::set-output name=JOB_DO_TESTING::${JOB_DO_TESTING}
166 # # * test only library unit tests and binary for arm-type targets
148 # # * test only library unit tests and binary for arm-type targets
167 unset CARGO_TEST_OPTIONS
149 unset CARGO_TEST_OPTIONS
168 unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
150 unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
@@ -241,11 +223,6 @@ jobs:
241 use-cross: ${{ matrix.job.use-cross }}
223 use-cross: ${{ matrix.job.use-cross }}
242 command: check
224 command: check
243 args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
225 args: --target=${{ matrix.job.target }} --verbose --lib --no-default-features --features regex-onig,git,paging
244− - name: Upload build artifacts
245− uses: actions/upload-artifact@master
246− with:
247− name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
248− path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
249 - name: Package
226 - name: Package
250 shell: bash
227 shell: bash
251 run: |
228 run: |
@@ -358,9 +335,20 @@ jobs:
358 # build dpkg
335 # build dpkg
359 fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
336 fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
360 fi
337 fi
338+ - name: Upload package artifact
339+ uses: actions/upload-artifact@master
340+ with:
341+ name: ${{ steps.vars.outputs.PKG_NAME }}
342+ path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
343+ - name: Upload Debian package artifact
344+ uses: actions/upload-artifact@master
345+ if: steps.vars.outputs.DPKG_NAME
346+ with:
347+ name: ${{ steps.vars.outputs.DPKG_NAME }}
348+ path: ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}
361 - name: Publish archives and packages
349 - name: Publish archives and packages
362 uses: softprops/action-gh-release@v1
350 uses: softprops/action-gh-release@v1
363− if: steps.vars.outputs.DEPLOY
351+ if: steps.vars.outputs.IS_RELEASE
364 with:
352 with:
365 files: |
353 files: |
366 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
354 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
@@ -375,11 +363,10 @@ jobs:
375 strategy:
363 strategy:
376 fail-fast: true
364 fail-fast: true
377 matrix:
365 matrix:
378− # job: [ { os: ubuntu-latest }, { os: macos-latest }, { os: windows-latest } ]
379 job:
366 job:
380− - { os: ubuntu-latest , toolchain: nightly-2020-04-29 }
367+ - { os: ubuntu-18.04 , toolchain: nightly-2020-04-29 }
381− - { os: macos-latest , toolchain: nightly-2020-04-29 }
368+ - { os: macos-10.15 , toolchain: nightly-2020-04-29 }
382− - { os: windows-latest , toolchain: nightly-2020-04-29-x86_64-pc-windows-gnu }
369+ - { os: windows-2019 , toolchain: nightly-2020-04-29-x86_64-pc-windows-gnu }
383 steps:
370 steps:
384 - uses: actions/checkout@v2
371 - uses: actions/checkout@v2
385 - name: Initialize workflow variables
372 - name: Initialize workflow variables
.gitmodules+3
@@ -213,3 +213,6 @@
213[submodule "assets/syntaxes/02_Extra/Zig"]
213[submodule "assets/syntaxes/02_Extra/Zig"]
214 path = assets/syntaxes/02_Extra/Zig
214 path = assets/syntaxes/02_Extra/Zig
215 url = https://github.com/ziglang/sublime-zig-language.git
215 url = https://github.com/ziglang/sublime-zig-language.git
216+[submodule "assets/syntaxes/02_Extra/gnuplot"]
217+ path = assets/syntaxes/02_Extra/gnuplot
218+ url = https://github.com/hesstobi/sublime_gnuplot
CHANGELOG.md+5−2
@@ -12,23 +12,26 @@
12- Make ./tests/syntax-tests/regression_test.sh work on recent versions of macOS, see #1443 (@Enselic)
12- Make ./tests/syntax-tests/regression_test.sh work on recent versions of macOS, see #1443 (@Enselic)
13- VimL syntax highlighting fix, see #1450 (@esensar)
13- VimL syntax highlighting fix, see #1450 (@esensar)
14- Print an 'Invalid syntax theme settings' error message if a custom theme is broken, see #614 (@Enselic)
14- Print an 'Invalid syntax theme settings' error message if a custom theme is broken, see #614 (@Enselic)
15+- If plain mode is set and wrap is not explicitly opted in, long lines will no be truncated, see #1426
15- If `PAGER` (but not `BAT_PAGER` or `--pager`) is `more` or `most`, silently use `less` instead to ensure support for colors, see #1063 (@Enselic)
16- If `PAGER` (but not `BAT_PAGER` or `--pager`) is `more` or `most`, silently use `less` instead to ensure support for colors, see #1063 (@Enselic)
16
17
17## Other
18## Other
18
19
19- Performance improvements, see #1421 (@LovecraftianHorror)
20- Performance improvements, see #1421 (@LovecraftianHorror)
20- Added a new `--diagnostic` option to collect information for bug reports, see #1459 (@sharkdp)
21- Added a new `--diagnostic` option to collect information for bug reports, see #1459 (@sharkdp)
22+- Upped min required Rust version to 1.42
21
23
22## Syntaxes
24## Syntaxes
23
25
24- Added Zig syntax, see #1470 (@paulsmith)
26- Added Zig syntax, see #1470 (@paulsmith)
25- Added Lean syntax, see #1446 (@Julian)
27- Added Lean syntax, see #1446 (@Julian)
26- Added `.resource` extension for Robot Framework files, see #1386
28- Added `.resource` extension for Robot Framework files, see #1386
29+- Added `gnuplot` syntax, see #1431 (@sharkdp)
27
30
28## New themes
31## New themes
29
32
30−- `ansi` replaces `ansi-dark` and `ansi-light`, see #1104 and #1412 (@mk12)
33+- `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`.
31−- The Gruvbox theme has been updated, see #1291 (@j0hnmeow). **Breaking change:** users that were previously usuing `gruvbox` or `gruvbox-white` should update and use `gruvbox-dark`/`gruvbox-light` instead.
34+- 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.
32
35
33## `bat` as a library
36## `bat` as a library
34
37
Cargo.lock+14−14
@@ -186,9 +186,9 @@ dependencies = [
186
186
187[[package]]
187[[package]]
188name = "byteorder"
188name = "byteorder"
189−version = "1.3.4"
189+version = "1.4.2"
190source = "registry+https://github.com/rust-lang/crates.io-index"
190source = "registry+https://github.com/rust-lang/crates.io-index"
191−checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
191+checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
192
192
193[[package]]
193[[package]]
194name = "cc"
194name = "cc"
@@ -589,9 +589,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
589
589
590[[package]]
590[[package]]
591name = "libc"
591name = "libc"
592−version = "0.2.81"
592+version = "0.2.82"
593source = "registry+https://github.com/rust-lang/crates.io-index"
593source = "registry+https://github.com/rust-lang/crates.io-index"
594−checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
594+checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929"
595
595
596[[package]]
596[[package]]
597name = "libgit2-sys"
597name = "libgit2-sys"
@@ -628,9 +628,9 @@ dependencies = [
628
628
629[[package]]
629[[package]]
630name = "linked-hash-map"
630name = "linked-hash-map"
631−version = "0.5.3"
631+version = "0.5.4"
632source = "registry+https://github.com/rust-lang/crates.io-index"
632source = "registry+https://github.com/rust-lang/crates.io-index"
633−checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
633+checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
634
634
635[[package]]
635[[package]]
636name = "lock_api"
636name = "lock_api"
@@ -903,9 +903,9 @@ dependencies = [
903
903
904[[package]]
904[[package]]
905name = "regex"
905name = "regex"
906−version = "1.4.2"
906+version = "1.4.3"
907source = "registry+https://github.com/rust-lang/crates.io-index"
907source = "registry+https://github.com/rust-lang/crates.io-index"
908−checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
908+checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
909dependencies = [
909dependencies = [
910 "aho-corasick",
910 "aho-corasick",
911 "memchr",
911 "memchr",
@@ -915,9 +915,9 @@ dependencies = [
915
915
916[[package]]
916[[package]]
917name = "regex-syntax"
917name = "regex-syntax"
918−version = "0.6.21"
918+version = "0.6.22"
919source = "registry+https://github.com/rust-lang/crates.io-index"
919source = "registry+https://github.com/rust-lang/crates.io-index"
920−checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
920+checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
921
921
922[[package]]
922[[package]]
923name = "remove_dir_all"
923name = "remove_dir_all"
@@ -1058,9 +1058,9 @@ checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
1058
1058
1059[[package]]
1059[[package]]
1060name = "smallvec"
1060name = "smallvec"
1061−version = "1.6.0"
1061+version = "1.6.1"
1062source = "registry+https://github.com/rust-lang/crates.io-index"
1062source = "registry+https://github.com/rust-lang/crates.io-index"
1063−checksum = "1a55ca5f3b68e41c979bf8c46a6f1da892ca4db8f94023ce0bd32407573b1ac0"
1063+checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
1064
1064
1065[[package]]
1065[[package]]
1066name = "snailquote"
1066name = "snailquote"
@@ -1190,9 +1190,9 @@ dependencies = [
1190
1190
1191[[package]]
1191[[package]]
1192name = "thread_local"
1192name = "thread_local"
1193−version = "1.0.1"
1193+version = "1.1.0"
1194source = "registry+https://github.com/rust-lang/crates.io-index"
1194source = "registry+https://github.com/rust-lang/crates.io-index"
1195−checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
1195+checksum = "bb9bc092d0d51e76b2b19d9d85534ffc9ec2db959a2523cdae0697e2972cd447"
1196dependencies = [
1196dependencies = [
1197 "lazy_static",
1197 "lazy_static",
1198]
1198]
README.md+2−1
@@ -356,7 +356,7 @@ binaries are also available: look for archives with `musl` in the file name.
356
356
357### From source
357### From source
358
358
359−If you want to build `bat` from source, you need Rust 1.40 or
359+If you want to build `bat` from source, you need Rust 1.42 or
360higher. You can then use `cargo` to build everything:
360higher. You can then use `cargo` to build everything:
361
361
362```bash
362```bash
@@ -700,6 +700,7 @@ Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
700- [sharkdp](https://github.com/sharkdp)
700- [sharkdp](https://github.com/sharkdp)
701- [eth-p](https://github.com/eth-p)
701- [eth-p](https://github.com/eth-p)
702- [keith-hall](https://github.com/keith-hall)
702- [keith-hall](https://github.com/keith-hall)
703+- [Enselic](https://github.com/Enselic)
703
704
704## Project goals and alternatives
705## Project goals and alternatives
705
706
assets/syntaxes/02_Extra/gnuplotnew file+1

Submodule changed.

assets/syntaxes/02_Extra/gnuplot.sublime-syntaxnew file+182
@@ -0,0 +1,182 @@
1+%YAML 1.2
2+---
3+# http://www.sublimetext.com/docs/3/syntax.html
4+name: gnuplot
5+file_extensions:
6+ - gp
7+ - gpl
8+ - gnuplot
9+ - gnu
10+ - plot
11+ - plt
12+scope: source.gnuplot
13+contexts:
14+ main:
15+ - include: number
16+ - include: string_single
17+ - include: string_double
18+ - match: '\b(for)\b\s*(\[)'
19+ comment: |
20+ gnuplot iteration statement.
21+ There are two forms:
22+ numeric [n = 1:2{:inc}]
23+ string based [str in "x y z"]
24+ but both can also iterate over lists etc, so this is kept loose.
25+ captures:
26+ 1: keyword.other.iteration.gnuplot
27+ 2: punctuation.definition.range.begin.gnuplot
28+ push:
29+ - meta_scope: meta.structure.iteration.gnuplot
30+ - match: '\]'
31+ captures:
32+ 0: punctuation.definition.range.end.gnuplot
33+ pop: true
34+ - include: number
35+ - include: operator
36+ - include: string_double
37+ - include: string_single
38+ - match: ":"
39+ scope: punctuation.separator.range.gnuplot
40+ - match: '\b([a-zA-Z]\w*)\b\s*(=|in)'
41+ scope: variable-assignment.range.gnuplot
42+ - match: '(?i:[^\s(pi|e)\]])'
43+ scope: invalid.illegal.expected-range-separator.gnuplot
44+ - match: '\['
45+ comment: "gnuplot range statement [a:b]. Lots of things are legal, still more make no sense!"
46+ captures:
47+ 0: punctuation.definition.range.begin.gnuplot
48+ push:
49+ - meta_scope: meta.structure.range.gnuplot
50+ - match: '\]'
51+ captures:
52+ 0: punctuation.definition.range.end.gnuplot
53+ pop: true
54+ - include: number
55+ - include: operator
56+ - match: ":"
57+ scope: punctuation.separator.range.gnuplot
58+ - match: '(?i:[^\s(pi|e)\]])'
59+ scope: invalid.illegal.expected-range-separator.gnuplot
60+ - match: \\.
61+ scope: constant.character.escape.gnuplot
62+ - match: '(?<!\$)(#)(?!\{).*$\n?'
63+ scope: comment.line.number-sign.gnuplot
64+ captures:
65+ 1: punctuation.definition.comment.gnuplot
66+ - match: for
67+ comment: introduce in gnuplot 4.3.
68+ scope: keyword.other.iteration.gnuplot
69+ - 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
70+ scope: keyword.other.setting.gnuplot
71+ - 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
72+ comment: missuse of scopes alert! Just for pretty colours
73+ scope: keyword.other.command.gnuplot
74+ - 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
75+ scope: support.function.gnuplot
76+ - match: \b(gprintf|sprintf|strlen|strstrt|substr|system|word|words)\b
77+ scope: support.function.string.gnuplot
78+ - 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
79+ scope: constant.other.type.gnuplot
80+ - 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
81+ scope: constant.other.terminal.gnuplot
82+ - match: \b(u(sing)?|t(it(le)?)?|notit(le)?|w(i(th)?)?|steps|fs(teps)?|notitle|l(i(nes)?)?|linespoints|via)\b
83+ scope: keyword.modifier.gnuplot
84+ - match: |-
85+ (?x:
86+ \b # Start with a word boundary
87+ (?=\b[\w$]*(\(|.*=)) # Look-ahead for a bracket or equals
88+ (?![^(]*\)) # negative look ahead for a closing bracket without an opening one. This stops a from matching in f(a)
89+ ( # Group variable name
90+ [A-Za-z] # A letter
91+ [\w$]* # Any word chars or $
92+ ) # That is it for the name.
93+ )
94+ comment: user defined function / variable
95+ scope: variable.other.gnuplot
96+ - match: \b(if)\b
97+ scope: keyword.control.gnuplot
98+ - match: \b(show)\b
99+ captures:
100+ 0: keyword.other.command.gnuplot
101+ push:
102+ - meta_scope: keyword.line.show.gnuplot
103+ - meta_content_scope: keyword.line.show.gnuplot
104+ - match: (?!\#)($\n?)
105+ pop: true
106+ - include: main
107+ - match: \b(set)\b\s*\b(terminal|term)\b
108+ captures:
109+ 1: keyword.other.command.gnuplot
110+ 2: keyword.other.setting.gnuplot
111+ push:
112+ - meta_scope: keyword.line.set.terminal.gnuplot
113+ - match: (?!\#)($\n?)
114+ pop: true
115+ - include: main
116+ - match: \b(set)\b\s*\b(key)\b
117+ captures:
118+ 1: keyword.other.command.gnuplot
119+ 2: keyword.other.setting.gnuplot
120+ push:
121+ - meta_scope: keyword.line.set.key.gnuplot
122+ - match: (?!\#)($\n?)
123+ pop: true
124+ - include: main
125+ - match: \b(set|unset)\b\s*(?!\b(terminal|key|for)\b)
126+ captures:
127+ 1: keyword.other.command.gnuplot
128+ 2: keyword.other.setting.gnuplot
129+ push:
130+ - meta_scope: keyword.line.set.gnuplot
131+ - meta_content_scope: keyword.line.set.gnuplot
132+ - match: (?!\#)($\n?)
133+ pop: true
134+ - include: main
135+ number:
136+ - match: |-
137+ (?x: # turn on extended mode
138+ -? # an optional minus
139+ (?:
140+ 0 # a zero
141+ | # ...or...
142+ [1-9] # a 1-9 character
143+ \d* # followed by zero or more digits
144+ )
145+ (?:
146+ \. # a period
147+ \d+ # followed by one or more digits
148+ (?:
149+ [eE] # an e character
150+ [+-]? # followed by an option +/-
151+ \d+ # followed by one or more digits
152+ )? # make exponent optional
153+ )? # make decimal portion optional
154+ )
155+ comment: borrowed from textmate book
156+ scope: constant.numeric.gnuplot
157+ operator:
158+ - match: \s*(==|~=|>|>=|<|<=|&|&&|:|\||\|\||\+|-|\*|\.\*|/|\./|\\|\.\\|\^|\.\^)\s*
159+ comment: Operator symbols
160+ scope: keyword.operator.symbols.matlab
161+ string_double:
162+ - match: '"'
163+ captures:
164+ 0: punctuation.definition.string.begin.gnuplot
165+ push:
166+ - meta_scope: string.quoted.double.gnuplot
167+ - match: '"'
168+ captures:
169+ 0: punctuation.definition.string.end.gnuplot
170+ pop: true
171+ - match: '\\[\$`"\\\n]'
172+ scope: constant.character.escape.gnuplot
173+ string_single:
174+ - match: "'"
175+ captures:
176+ 0: punctuation.definition.string.begin.gnuplot
177+ push:
178+ - meta_scope: string.quoted.single.gnuplot
179+ - match: "'"
180+ captures:
181+ 0: punctuation.definition.string.end.gnuplot
182+ pop: true
doc/README-ru.md+1−1
@@ -341,7 +341,7 @@ ansible-galaxy install aeimer.install_bat
341
341
342### Из исходников
342### Из исходников
343
343
344−Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.40 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
344+Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.42 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
345
345
346```bash
346```bash
347cargo install --locked bat
347cargo install --locked bat
doc/assets.md+1−1
@@ -23,7 +23,7 @@ in the `.sublime-syntax` format.
23
23
245. Use `bat --list-languages` to check if the new languages are available.
245. Use `bat --list-languages` to check if the new languages are available.
25
25
26−6. Add a syntax test for the new language. See [#Syntax-tests](below) for details.
26+6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.
27
27
287. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
287. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
29 file. A new binary cache file will be created once before every new release of `bat`.
29 file. A new binary cache file will be created once before every new release of `bat`.
src/bin/bat/app.rs+3−3
@@ -150,10 +150,10 @@ impl App {
150 wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
150 wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
151 match self.matches.value_of("wrap") {
151 match self.matches.value_of("wrap") {
152 Some("character") => WrappingMode::Character,
152 Some("character") => WrappingMode::Character,
153− Some("never") => WrappingMode::NoWrapping,
153+ Some("never") => WrappingMode::NoWrapping(true),
154 Some("auto") | None => {
154 Some("auto") | None => {
155 if style_components.plain() {
155 if style_components.plain() {
156− WrappingMode::NoWrapping
156+ WrappingMode::NoWrapping(false)
157 } else {
157 } else {
158 WrappingMode::Character
158 WrappingMode::Character
159 }
159 }
@@ -163,7 +163,7 @@ impl App {
163 } else {
163 } else {
164 // We don't have the tty width when piping to another program.
164 // We don't have the tty width when piping to another program.
165 // There's no point in wrapping when this is the case.
165 // There's no point in wrapping when this is the case.
166− WrappingMode::NoWrapping
166+ WrappingMode::NoWrapping(false)
167 },
167 },
168 colored_output: self.matches.is_present("force-colorization")
168 colored_output: self.matches.is_present("force-colorization")
169 || match self.matches.value_of("color") {
169 || match self.matches.value_of("color") {
src/bin/bat/input.rs+1−1
@@ -2,7 +2,7 @@ use bat::input::Input;
2use std::ffi::OsStr;
2use std::ffi::OsStr;
3
3
4pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
4pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
5− named(Input::ordinary_file(file), name.or_else(|| Some(file)))
5+ named(Input::ordinary_file(file), name.or(Some(file)))
6}
6}
7
7
8pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
8pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
src/bin/bat/main.rs+3−2
@@ -205,7 +205,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
205 and are added to the cache with `bat cache --build`. \
205 and are added to the cache with `bat cache --build`. \
206 For more information, see:\n\n \
206 For more information, see:\n\n \
207 https://github.com/sharkdp/bat#adding-new-themes",
207 https://github.com/sharkdp/bat#adding-new-themes",
208− config_file().join("themes").to_string_lossy()
208+ PROJECT_DIRS.config_dir().join("themes").to_string_lossy()
209 )?;
209 )?;
210 } else {
210 } else {
211 for theme in assets.themes() {
211 for theme in assets.themes() {
@@ -237,10 +237,10 @@ fn run() -> Result<bool> {
237 .info(EnvironmentVariables::list(&[
237 .info(EnvironmentVariables::list(&[
238 "SHELL",
238 "SHELL",
239 "PAGER",
239 "PAGER",
240+ "BAT_PAGER",
240 "BAT_CACHE_PATH",
241 "BAT_CACHE_PATH",
241 "BAT_CONFIG_PATH",
242 "BAT_CONFIG_PATH",
242 "BAT_OPTS",
243 "BAT_OPTS",
243− "BAT_PAGER",
244 "BAT_STYLE",
244 "BAT_STYLE",
245 "BAT_TABS",
245 "BAT_TABS",
246 "BAT_THEME",
246 "BAT_THEME",
@@ -248,6 +248,7 @@ fn run() -> Result<bool> {
248 "XDG_CACHE_HOME",
248 "XDG_CACHE_HOME",
249 "COLORTERM",
249 "COLORTERM",
250 "NO_COLOR",
250 "NO_COLOR",
251+ "MANPAGER",
251 ]))
252 ]))
252 .info(FileContent::new("Config file", config_file()))
253 .info(FileContent::new("Config file", config_file()))
253 .info(CompileTimeInformation::default())
254 .info(CompileTimeInformation::default())
src/input.rs+1−5
@@ -137,11 +137,7 @@ impl<'a> Input<'a> {
137 }
137 }
138
138
139 pub fn is_stdin(&self) -> bool {
139 pub fn is_stdin(&self) -> bool {
140− if let InputKind::StdIn = self.kind {
140+ matches!(self.kind, InputKind::StdIn)
141− true
142− } else {
143− false
144− }
145 }
141 }
146
142
147 pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
143 pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
src/output.rs+2−6
@@ -81,7 +81,7 @@ impl OutputType {
81 p.arg("--quit-if-one-screen");
81 p.arg("--quit-if-one-screen");
82 }
82 }
83
83
84− if wrapping_mode == WrappingMode::NoWrapping {
84+ if wrapping_mode == WrappingMode::NoWrapping(true) {
85 p.arg("--chop-long-lines");
85 p.arg("--chop-long-lines");
86 }
86 }
87
87
@@ -121,11 +121,7 @@ impl OutputType {
121
121
122 #[cfg(feature = "paging")]
122 #[cfg(feature = "paging")]
123 pub(crate) fn is_pager(&self) -> bool {
123 pub(crate) fn is_pager(&self) -> bool {
124− if let OutputType::Pager(_) = self {
124+ matches!(self, OutputType::Pager(_))
125− true
126− } else {
127− false
128− }
129 }
125 }
130
126
131 #[cfg(not(feature = "paging"))]
127 #[cfg(not(feature = "paging"))]
src/pretty_printer.rs+6
@@ -320,6 +320,12 @@ impl<'a> PrettyPrinter<'a> {
320 }
320 }
321}
321}
322
322
323+impl Default for PrettyPrinter<'_> {
324+ fn default() -> Self {
325+ Self::new()
326+ }
327+}
328+
323/// An input source for the pretty printer.
329/// An input source for the pretty printer.
324pub struct Input<'a> {
330pub struct Input<'a> {
325 input: input::Input<'a>,
331 input: input::Input<'a>,
src/printer.rs+1−1
@@ -424,7 +424,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
424 }
424 }
425
425
426 // Line contents.
426 // Line contents.
427− if self.config.wrapping_mode == WrappingMode::NoWrapping {
427+ if matches!(self.config.wrapping_mode, WrappingMode::NoWrapping(_)) {
428 let true_color = self.config.true_color;
428 let true_color = self.config.true_color;
429 let colored_output = self.config.colored_output;
429 let colored_output = self.config.colored_output;
430 let italics = self.config.use_italic_text;
430 let italics = self.config.use_italic_text;
src/wrapping.rs+3−2
@@ -1,11 +1,12 @@
1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum WrappingMode {
2pub enum WrappingMode {
3 Character,
3 Character,
4+ // The bool specifies whether wrapping has been explicitly disabled by the user via --wrap=never
4− NoWrapping,
5+ NoWrapping(bool),
5}
6}
6
7
7impl Default for WrappingMode {
8impl Default for WrappingMode {
8 fn default() -> Self {
9 fn default() -> Self {
9− WrappingMode::NoWrapping
10+ WrappingMode::NoWrapping(false)
10 }
11 }
11}
12}
tests/assets.rs+1−1
@@ -8,7 +8,7 @@ fn all_themes_are_present() {
8 let assets = HighlightingAssets::from_binary();
8 let assets = HighlightingAssets::from_binary();
9
9
10 let mut themes: Vec<_> = assets.themes().collect();
10 let mut themes: Vec<_> = assets.themes().collect();
11− themes.sort();
11+ themes.sort_unstable();
12
12
13 assert_eq!(
13 assert_eq!(
14 themes,
14 themes,
tests/snapshot_tests.rs+1−1
@@ -7,7 +7,7 @@ macro_rules! snapshot_tests {
7 $(
7 $(
8 #[test]
8 #[test]
9 fn $test_name() {
9 fn $test_name() {
10− let bat_tester = BatTester::new();
10+ let bat_tester = BatTester::default();
11 bat_tester.test_snapshot(stringify!($test_name), $style);
11 bat_tester.test_snapshot(stringify!($test_name), $style);
12 }
12 }
13 )*
13 )*
tests/syntax-tests/highlighted/gnuplot/test.gpnew file+19
@@ -0,0 +1,19 @@
1+set terminal pngcairo enhanced
2+set output "/tmp/polynomial.png"
3+
4+set grid
5+
6+set xrange [-5:5]
7+set yrange [-5:10]
8+
9+set samples 10000
10+
11+set key bottom right
12+
13+f(x) = 1.0 / 14.0 * ((x+4) * (x+1) * (x-1) * (x-3)) + 0.5
14+
15+plot \
16+ f(x) title "polynomial of degree 4" \
17+ with lines \
18+ linewidth 2 \
19+ linetype rgb '#0077ff'
tests/syntax-tests/source/gnuplot/test.gpnew file+19
@@ -0,0 +1,19 @@
1+set terminal pngcairo enhanced
2+set output "/tmp/polynomial.png"
3+
4+set grid
5+
6+set xrange [-5:5]
7+set yrange [-5:10]
8+
9+set samples 10000
10+
11+set key bottom right
12+
13+f(x) = 1.0 / 14.0 * ((x+4) * (x+1) * (x-1) * (x-3)) + 0.5
14+
15+plot \
16+ f(x) title "polynomial of degree 4" \
17+ with lines \
18+ linewidth 2 \
19+ linetype rgb '#0077ff'
tests/tester.rs+19−17
@@ -19,23 +19,6 @@ pub struct BatTester {
19}
19}
20
20
21impl BatTester {
21impl BatTester {
22− pub fn new() -> Self {
23− let temp_dir = create_sample_directory().expect("sample directory");
24−
25− let root = env::current_exe()
26− .expect("tests executable")
27− .parent()
28− .expect("tests executable directory")
29− .parent()
30− .expect("bat executable directory")
31− .to_path_buf();
32−
33− let exe_name = if cfg!(windows) { "bat.exe" } else { "bat" };
34− let exe = root.join(exe_name);
35−
36− BatTester { temp_dir, exe }
37− }
38−
39 pub fn test_snapshot(&self, name: &str, style: &str) {
22 pub fn test_snapshot(&self, name: &str, style: &str) {
40 let output = Command::new(&self.exe)
23 let output = Command::new(&self.exe)
41 .current_dir(self.temp_dir.path())
24 .current_dir(self.temp_dir.path())
@@ -66,6 +49,25 @@ impl BatTester {
66 }
49 }
67}
50}
68
51
52+impl Default for BatTester {
53+ fn default() -> Self {
54+ let temp_dir = create_sample_directory().expect("sample directory");
55+
56+ let root = env::current_exe()
57+ .expect("tests executable")
58+ .parent()
59+ .expect("tests executable directory")
60+ .parent()
61+ .expect("bat executable directory")
62+ .to_path_buf();
63+
64+ let exe_name = if cfg!(windows) { "bat.exe" } else { "bat" };
65+ let exe = root.join(exe_name);
66+
67+ BatTester { temp_dir, exe }
68+ }
69+}
70+
69fn create_sample_directory() -> Result<TempDir, git2::Error> {
71fn create_sample_directory() -> Result<TempDir, git2::Error> {
70 // Create temp directory and initialize repository
72 // Create temp directory and initialize repository
71 let temp_dir = TempDir::new("bat-tests").expect("Temp directory");
73 let temp_dir = TempDir::new("bat-tests").expect("Temp directory");