summaryrefslogtreecommitdiff
path: root/internal/clients/grepclient.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/clients/grepclient.go')
-rw-r--r--internal/clients/grepclient.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/clients/grepclient.go b/internal/clients/grepclient.go
index ea5022b..ae21ff2 100644
--- a/internal/clients/grepclient.go
+++ b/internal/clients/grepclient.go
@@ -7,6 +7,8 @@ import (
"strings"
"github.com/mimecast/dtail/internal/clients/handlers"
+ "github.com/mimecast/dtail/internal/config"
+ "github.com/mimecast/dtail/internal/io/dlog"
"github.com/mimecast/dtail/internal/omode"
)
@@ -16,7 +18,7 @@ type GrepClient struct {
}
// NewGrepClient creates a new grep client.
-func NewGrepClient(args Args) (*GrepClient, error) {
+func NewGrepClient(args config.Args) (*GrepClient, error) {
if args.RegexStr == "" {
return nil, errors.New("No regex specified, use '-regex' flag")
}
@@ -41,12 +43,13 @@ func (c GrepClient) makeHandler(server string) handlers.Handler {
}
func (c GrepClient) makeCommands() (commands []string) {
+ regex, err := c.Regex.Serialize()
+ if err != nil {
+ dlog.Client.FatalPanic(err)
+ }
for _, file := range strings.Split(c.What, ",") {
commands = append(commands, fmt.Sprintf("%s:%s %s %s",
- c.Mode.String(),
- c.Args.SerializeOptions(),
- file,
- c.Regex.Serialize()))
+ c.Mode.String(), c.Args.SerializeOptions(), file, regex))
}
return