...
1 package b
2
3 import (
4 . "github.com/alecthomas/chroma"
5 "github.com/alecthomas/chroma/lexers/internal"
6 )
7
8
9 var BashSession = internal.Register(MustNewLazyLexer(
10 &Config{
11 Name: "BashSession",
12 Aliases: []string{"bash-session", "console", "shell-session"},
13 Filenames: []string{".sh-session"},
14 MimeTypes: []string{"text/x-sh"},
15 EnsureNL: true,
16 },
17 bashsessionRules,
18 ))
19
20 func bashsessionRules() Rules {
21 return Rules{
22 "root": {
23 {`^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)`, ByGroups(GenericPrompt, Text, Using(Bash)), nil},
24 {`^.+\n?`, GenericOutput, nil},
25 },
26 }
27 }
28
View as plain text