Added motd parser

This commit is contained in:
2024-05-20 19:43:05 +02:00
parent fe2962b1f7
commit 29281cd6e4
2 changed files with 3 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ var (
font *string = flag.String("font", "", "Font name to use") font *string = flag.String("font", "", "Font name to use")
fontpath *string = flag.String("fontpath", "", "Font path to load fonts from") fontpath *string = flag.String("fontpath", "", "Font path to load fonts from")
colors *string = flag.String("colors", "", "Character colors separated by ';'\n\tPossible colors: black, red, green, yellow, blue, magenta, cyan, white, or any hexcode (f.e. '885DBA')") colors *string = flag.String("colors", "", "Character colors separated by ';'\n\tPossible colors: black, red, green, yellow, blue, magenta, cyan, white, or any hexcode (f.e. '885DBA')")
parser *string = flag.String("parser", "terminal", "Parser to use\tPossible parsers: terminal, html") parser *string = flag.String("parser", "terminal", "Parser to use\tPossible parsers: terminal, html, motd")
file *string = flag.String("file", "", "File to write to") file *string = flag.String("file", "", "File to write to")
) )

View File

@@ -22,6 +22,8 @@ var parsers map[string]Parser = map[string]Parser{
"terminal": {"terminal", "", "", "\n", nil}, "terminal": {"terminal", "", "", "\n", nil},
// Parser for HTML code // Parser for HTML code
"html": {"html", "<code>", "</code>", "<br>", map[string]string{" ": "&nbsp;"}}, "html": {"html", "<code>", "</code>", "<br>", map[string]string{" ": "&nbsp;"}},
// Parser for motd file
"motd": {"motd", "#!/bin/sh\ncat << 'EOF'\n", "EOF", "\n", nil},
} }
// GetParser returns a parser by its key // GetParser returns a parser by its key