Skip to content

Commit 071acc3

Browse files
boukAntoine Grondin
authored andcommitted
Add verbose comment explaning the regex
1 parent 93d28d1 commit 071acc3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docker_compose_handler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import (
55
)
66

77
// dcLogsPrefixRe parses out a prefix like 'web_1 | ' from docker-compose
8+
// The regex exists of five parts:
9+
// 1. An optional color terminal escape sequence
10+
// 2. The name of the service
11+
// 3. Any number of spaces, and a pipe symbol
12+
// 4. An optional color reset escape sequence
13+
// 5. The rest of the line
814
var dcLogsPrefixRe = regexp.MustCompile("^(?:\x1b\\[\\d+m)?(?P<service_name>[a-zA-Z0-9._-]+)\\s+\\|(?:\x1b\\[0m)? (?P<rest_of_line>.*)$")
915

1016
type handler interface {

0 commit comments

Comments
 (0)