mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-18 20:11:03 +00:00
replace Syslog dependency with a custom syntax
This commit is contained in:
parent
ba0d43672b
commit
1537733e6b
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -97,10 +97,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
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
|
||||
|
||||
## New themes
|
||||
|
||||
## `bat` as a library
|
||||
|
1
assets/syntaxes/02_Extra/Syslog
vendored
1
assets/syntaxes/02_Extra/Syslog
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 7628d4e0b89d3b4f0dcc014bfb4a3e3433f5133a
|
70
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
70
assets/syntaxes/02_Extra/syslog.sublime-syntax
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: syslog
|
||||
file_extensions:
|
||||
- syslog
|
||||
scope: text.syslog
|
||||
contexts:
|
||||
main:
|
||||
- match: '^\w+\s+\d+\s+\d{2}:\d{2}:\d{2}'
|
||||
scope: meta.datetime.syslog constant.numeric.syslog
|
||||
push: loghost
|
||||
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.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: (\w+)(=)
|
||||
captures:
|
||||
1: variable.parameter.syslog
|
||||
2: keyword.operator.assignment.syslog
|
||||
- match: (')([^']*)(')
|
||||
scope: string.quoted.single.syslog
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.syslog
|
||||
3: punctuation.definition.string.end.syslog
|
||||
- match: (")([^"]*)(")
|
||||
scope: string.quoted.double.syslog
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.syslog
|
||||
3: punctuation.definition.string.end.syslog
|
||||
- match: \d+
|
||||
scope: meta.number.integer.syslog constant.numeric.value.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
|
||||
- match: $
|
||||
pop: true
|
5
tests/syntax-tests/highlighted/Syslog/example.syslog
Normal file
5
tests/syntax-tests/highlighted/Syslog/example.syslog
Normal file
@ -0,0 +1,5 @@
|
||||
[38;2;190;132;255mApr 4 00: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: logrotate.service: Succeeded.[0m
|
||||
[38;2;190;132;255mApr 4 00: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: Finished Rotate log files.[0m
|
||||
[38;2;190;132;255mApr 4 00: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[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;248;248;242m.[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 09: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: (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 22: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[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
|
Loading…
x
Reference in New Issue
Block a user