Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:cloud66/habitus
Browse files Browse the repository at this point in the history
# Conflicts:
#	main.go
  • Loading branch information
lvangool committed Mar 16, 2016
2 parents 63e4ecc + faf3242 commit 847b0e7
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ import (
"github.com/bugsnag/bugsnag-go"
)

var format = logging.MustStringFormatter(
var prettyFormat = logging.MustStringFormatter(
"%{color}▶ %{message} %{color:reset}",
)
var plainFormat = logging.MustStringFormatter(
"> %{message}",
)

var (
flagLevel string
flagShowHelp bool
flagShowVersion bool
VERSION string = "0.3.0"
flagPrettyLog bool
VERSION string = "dev"
BUILD_DATE string = ""
)

Expand All @@ -37,7 +41,7 @@ func main() {
defer bugsnag.AutoNotify()

var log = logging.MustGetLogger("habitus")
logging.SetFormatter(format)
logging.SetFormatter(plainFormat)

config := configuration.CreateConfig()
flag.StringVar(&config.Buildfile, "f", "build.yml", "Build file path. Defaults to build.yml in the workdir")
Expand All @@ -48,6 +52,7 @@ func main() {
flag.BoolVar(&config.ForceRmTmpContainer, "force-rm", false, "Force remove intermediate containers")
flag.StringVar(&config.UniqueID, "uid", "", "Unique ID for the build. Used only for multi-tenanted build environments")
flag.StringVar(&flagLevel, "level", "debug", "Log level: debug, info, notice, warning, error and critical")
flag.BoolVar(&flagPrettyLog, "pretty", true, "Display logs with color and formatting")
flag.StringVar(&config.DockerHost, "host", os.Getenv("DOCKER_HOST"), "Docker host link. Uses DOCKER_HOST if missing")
flag.StringVar(&config.DockerCert, "certs", os.Getenv("DOCKER_CERT_PATH"), "Docker cert folder. Uses DOCKER_CERT_PATH if missing")
flag.Var(&config.EnvVars, "env", "Environment variables to be used during build. Uses parent process environment variables if empty")
Expand All @@ -62,9 +67,13 @@ func main() {
flag.StringVar(&config.ApiBinding, "binding", "192.168.99.1", "Network address to bind the API to. (see documentation for more info)")

config.Logger = *log

flag.Parse()

if flagPrettyLog {
logging.SetFormatter(prettyFormat)
// config.Logger = *log
}

if flagShowHelp || (len(args) > 0 && args[0] == "help") {
fmt.Println("Habitus - (c) 2016 Cloud 66 Inc.")
flag.PrintDefaults()
Expand Down

0 comments on commit 847b0e7

Please sign in to comment.