From 39e9c2d5178137a687d98aae5fb0fe3bd4b4d8dc Mon Sep 17 00:00:00 2001 From: Adrien Leravat Date: Thu, 4 Apr 2019 22:08:10 -0700 Subject: [PATCH] Move `Exec` to its own package under `internal/pkg` --- cmd/crowlet/crowlet.go | 7 ++++--- {util => internal/pkg}/exec.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) rename {util => internal/pkg}/exec.go (98%) diff --git a/cmd/crowlet/crowlet.go b/cmd/crowlet/crowlet.go index 7716199..cf82dae 100644 --- a/cmd/crowlet/crowlet.go +++ b/cmd/crowlet/crowlet.go @@ -4,8 +4,9 @@ import ( "os" "time" + exec "github.com/Pixep/crowlet/internal/pkg" "github.com/Pixep/crowlet/pkg/crawler" - "github.com/Pixep/crowlet/util" + log "github.com/Sirupsen/logrus" "github.com/urfave/cli" ) @@ -31,7 +32,7 @@ func beforeApp(c *cli.Context) error { } if len(c.GlobalString("pre-cmd")) > 1 { - ok := util.Exec(c.GlobalString("pre-cmd")) + ok := exec.Exec(c.GlobalString("pre-cmd")) if !ok { log.Fatal("Failed to execute command") } @@ -42,7 +43,7 @@ func beforeApp(c *cli.Context) error { func afterApp(c *cli.Context) error { if len(c.GlobalString("post-cmd")) > 1 { - ok := util.Exec(c.GlobalString("post-cmd")) + ok := exec.Exec(c.GlobalString("post-cmd")) if !ok { log.Fatal("Failed to execute command") } diff --git a/util/exec.go b/internal/pkg/exec.go similarity index 98% rename from util/exec.go rename to internal/pkg/exec.go index aa6e1f3..668edf8 100644 --- a/util/exec.go +++ b/internal/pkg/exec.go @@ -1,4 +1,4 @@ -package util +package exec import ( "bufio"