-
Notifications
You must be signed in to change notification settings - Fork 43
feat: improve colored output #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b2f70ec
7b8c59e
e22f312
cee07ba
f4d1bce
f963d29
c7792db
699ae2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,93 @@ | ||
| local termcolors = { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these come from a user's config, but default to these values to start, so they can be easily overridden?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. What do you think would be the best behavior here;
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Davincible I think in most cases plugin authors use |
||
| black = 30, | ||
| red = 31, | ||
| green = 32, | ||
| yellow = 33, | ||
| blue = 34, | ||
| magenta = 35, | ||
| cyan = 36, | ||
| white = 37, | ||
| } | ||
|
|
||
| local guicolors = { | ||
| green = "#14D000", | ||
| red = "#cc0000", | ||
| blue = "#729fcf", | ||
| cyan = "#20b2aa", | ||
| magenta = "#a474dc", | ||
| grey = "#777777", | ||
| yellow = "#deb887", | ||
| orange = "#ff7373", | ||
| } | ||
|
|
||
| local patterns = { | ||
| testfile = "^%s%s%s%s(.*_test.go):(%d+): ", | ||
| testlog = "^%s%s%s%s%s%s%s%s", | ||
| error = { "error" }, | ||
| -- Patterns to colorize in output | ||
| colors = { | ||
| pass = { pattern = "^%s*---%s+PASS:", gui = guicolors.green, term = termcolors.red }, | ||
| fail = { pattern = "^---%s+FAIL:", gui = guicolors.red, term = termcolors.green }, | ||
| skip = { pattern = "^---%s+SKIP:", gui = guicolors.blue, term = termcolors.yellow }, | ||
| build = { pattern = "^===%s+BUILD", gui = guicolors.yellow, term = termcolors.yellow }, | ||
| comment = { pattern = "^%s*#", gui = guicolors.grey, term = termcolors.blue }, | ||
| run = { | ||
| pattern = "^(===%s+RUN)%s+(.*)", | ||
| gui = { guicolors.grey, guicolors.yellow }, | ||
| term = { termcolors.blue, termcolors.blue }, | ||
| }, | ||
| signal = { | ||
| pattern = "^(%[signal)%s(.*)(:.*%])", | ||
| gui = { guicolors.grey, guicolors.blue, guicolors.grey }, | ||
| term = { termcolors.blue, termcolors.red, termcolors.blue }, | ||
| }, | ||
| panic = { | ||
| pattern = "^%s+(panic:)%s+(.*)", | ||
| gui = { guicolors.red, guicolors.orange }, | ||
| term = { termcolors.red, termcolors.red }, | ||
| }, | ||
| panic_recovered = { | ||
| pattern = "^(panic:)%s+(.*)%s(%[.*%])", | ||
| gui = { guicolors.red, guicolors.orange, guicolors.blue }, | ||
| term = { termcolors.red, termcolors.red, termcolors.blue }, | ||
| }, | ||
| go_routine = { | ||
| pattern = "^(goroutine)%s(%d+)%s(%[.*])(:)", | ||
| gui = { guicolors.grey, guicolors.magenta, guicolors.blue, guicolors.grey }, | ||
| term = { termcolors.blue, termcolors.blue, termcolors.magenta, termcolors.blue }, | ||
| }, | ||
| file = { | ||
| pattern = "^%s+(.*.go)(:%d+)", | ||
| gui = { guicolors.cyan, guicolors.magenta }, | ||
| term = { termcolors.cyan, termcolors.magenta }, | ||
| }, | ||
| file_column = { | ||
| pattern = "^%s*(.*.go)(:%d+)(:%d+)", | ||
| gui = { guicolors.cyan, guicolors.magenta, guicolors.blue }, | ||
| term = { termcolors.cyan, termcolors.magenta, termcolors.blue }, | ||
| }, | ||
| file_panic = { | ||
| pattern = "^%s+(.*.go)(:%d+)%s+(%+0x%w+)", | ||
| gui = { guicolors.cyan, guicolors.magenta, guicolors.grey }, | ||
| term = { termcolors.cyan, termcolors.magenta, termcolors.blue }, | ||
| }, | ||
| -- Color error messages from github.com/stretchr/testify | ||
| testify_error_trace = { | ||
| pattern = "^%s+(Error Trace:)%s+(.*)", | ||
| gui = { guicolors.grey, guicolors.grey }, | ||
| term = { termcolors.yellow, termcolors.blue }, | ||
| }, | ||
| testify_error = { | ||
| pattern = "^%s+(Error:)%s+(.*)", | ||
| gui = { guicolors.red, guicolors.red }, | ||
| term = { termcolors.yellow, termcolors.yellow }, | ||
| }, | ||
| testify_test = { | ||
| pattern = "^%s+(Test:)%s+(.*)", | ||
| gui = { guicolors.grey, guicolors.yellow }, | ||
| term = { termcolors.blue, termcolors.blue }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| return patterns | ||
Uh oh!
There was an error while loading. Please reload this page.