summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/v2/lexers/bash.go')
-rw-r--r--vendor/github.com/alecthomas/chroma/v2/lexers/bash.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go b/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go
new file mode 100644
index 0000000..1ea30f2
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go
@@ -0,0 +1,17 @@
+package lexers
+
+import (
+ "regexp"
+)
+
+// TODO(moorereason): can this be factored away?
+var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`)
+
+func init() { // nolint: gochecknoinits
+ Get("bash").SetAnalyser(func(text string) float32 {
+ if bashAnalyserRe.FindString(text) != "" {
+ return 1.0
+ }
+ return 0.0
+ })
+}