mirror of
https://github.com/sharkdp/bat
synced 2026-06-09 10:03:18 +00:00
Merge pull request #3647 from mvanhorn/osc/3513-tcl-shebang
feat: add tclsh, wish, and expect shebang detection for Tcl syntax
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
|
- Add shebang-based detection for Tcl (`tclsh`, `wish`) and Expect (`expect`) scripts, see #3647 (@mvanhorn)
|
||||||
- Change the URL of Zig submodule from GitHub to Codeberg, see #3519 (@sorairolake)
|
- Change the URL of Zig submodule from GitHub to Codeberg, see #3519 (@sorairolake)
|
||||||
- Don't color strings inside CSV files, to make it easier to tell which column they belong to, see #3521 (@keith-hall)
|
- Don't color strings inside CSV files, to make it easier to tell which column they belong to, see #3521 (@keith-hall)
|
||||||
- Add syntax highlighting support for COBOL, see #3584 (@adukhan99)
|
- Add syntax highlighting support for COBOL, see #3584 (@adukhan99)
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git syntaxes/01_Packages/TCL/Tcl.sublime-syntax syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
index 1234567..abcdefg 100644
|
||||||
|
--- syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Tcl
|
||||||
|
file_extensions:
|
||||||
|
- tcl
|
||||||
|
+first_line_match: ^\#!.*\b(tclsh|wish|expect)\b
|
||||||
|
scope: source.tcl
|
||||||
|
variables:
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
set timeout 30
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env tclsh
|
||||||
|
puts "Hello from tclsh"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/wish
|
||||||
|
button .b -text "Click"
|
||||||
@@ -4202,3 +4202,36 @@ fn plain_without_diff_still_works() {
|
|||||||
.success()
|
.success()
|
||||||
.stdout("line 1\nline 2 modified\nline 3\nline 4 added\n");
|
.stdout("line 1\nline 2 modified\nline 3\nline 4 added\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_tclsh() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_tclsh")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_wish() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_wish")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_expect() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_expect")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/expect -f[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Expect script detected via expect shebang[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m timeout [0m[38;2;190;132;255m30[0m
|
||||||
|
[38;2;248;248;242mspawn[0m[38;2;248;248;242m ssh user@host[0m
|
||||||
|
[38;2;248;248;242mexpect[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpassword:[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242msend[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116msecret[0m[38;2;190;132;255m\r[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242mexpect[0m[38;2;248;248;242m [0m[38;2;249;38;114meof[0m
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/env tclsh[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Tcl script detected via tclsh shebang[0m
|
||||||
|
[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mHello from tclsh[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m x [0m[38;2;190;132;255m42[0m
|
||||||
|
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;255;255;255m$[0m[38;2;255;255;255mx[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;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpositive[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242m}[0m
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/wish[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Tk script detected via wish shebang[0m
|
||||||
|
[38;2;249;38;114mpackage[0m[38;2;248;248;242m require Tk[0m
|
||||||
|
[38;2;248;248;242mbutton[0m[38;2;248;248;242m .b [0m[38;2;249;38;114m-[0m[38;2;248;248;242mtext [0m[38;2;230;219;116m"[0m[38;2;230;219;116mClick[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mcommand [0m[38;2;248;248;242m{[0m[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mclicked[0m[38;2;230;219;116m"[0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;248;248;242mpack[0m[38;2;248;248;242m .b[0m
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
# Expect script detected via expect shebang
|
||||||
|
set timeout 30
|
||||||
|
spawn ssh user@host
|
||||||
|
expect "password:"
|
||||||
|
send "secret\r"
|
||||||
|
expect eof
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env tclsh
|
||||||
|
# Tcl script detected via tclsh shebang
|
||||||
|
puts "Hello from tclsh"
|
||||||
|
set x 42
|
||||||
|
if {$x > 0} {
|
||||||
|
puts "positive"
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/wish
|
||||||
|
# Tk script detected via wish shebang
|
||||||
|
package require Tk
|
||||||
|
button .b -text "Click" -command {puts "clicked"}
|
||||||
|
pack .b
|
||||||
Reference in New Issue
Block a user