From e88c08c44b89fdace6cca16f0a38ddfa65b69ddf Mon Sep 17 00:00:00 2001 From: alessio Date: Mon, 20 Mar 2017 00:31:52 +0100 Subject: [PATCH] cli layout updated --- realize.go | 8 ++++---- watcher/cmd.go | 48 +++++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/realize.go b/realize.go index 06a9cb7..a414ac5 100644 --- a/realize.go +++ b/realize.go @@ -177,7 +177,7 @@ func main() { fmt.Println(p.String("path")) handle(r.Blueprint.Add(p)) handle(r.Record(r)) - fmt.Println(r.Green.Bold("Your project was successfully added.")) + fmt.Println(r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"), r.Green.Bold("Your project was successfully added.")) return nil }, Before: func(c *cli.Context) error { @@ -853,7 +853,7 @@ func main() { }, }) handle(r.Record(r)) - fmt.Println(r.Green.Bold("Your project was successfully added.")) + fmt.Println(r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"), r.Green.Bold("Your project was successfully added.")) return nil }, Before: func(c *cli.Context) error { @@ -871,7 +871,7 @@ func main() { Action: func(p *cli.Context) error { handle(r.Blueprint.Remove(p)) handle(r.Record(r)) - fmt.Println(r.Green.Bold("Your project was successfully removed.")) + fmt.Println(r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"), r.Green.Bold("Your project was successfully removed.")) return nil }, Before: func(c *cli.Context) error { @@ -897,7 +897,7 @@ func main() { Usage: "Remove realize folder.", Action: func(p *cli.Context) error { handle(r.Settings.Remove()) - fmt.Println(r.Green.Bold("Realize folder successfully removed.")) + fmt.Println(r.Yellow.Bold("[")+"REALIZE"+r.Yellow.Bold("]"), r.Green.Bold("Realize folder successfully removed.")) return nil }, Before: func(c *cli.Context) error { diff --git a/watcher/cmd.go b/watcher/cmd.go index 85a72e1..450b3d6 100644 --- a/watcher/cmd.go +++ b/watcher/cmd.go @@ -88,47 +88,49 @@ func (h *Blueprint) List() error { err := h.check() if err == nil { for _, val := range h.Projects { - fmt.Println(h.Blue.Bold("|"), h.Blue.Bold(strings.ToUpper(val.Name))) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Base Path"), ":", h.Magenta.Regular(val.Path)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Fmt"), ":", h.Magenta.Regular(val.Fmt)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Generate"), ":", h.Magenta.Regular(val.Generate)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Test"), ":", h.Magenta.Regular(val.Test)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Install"), ":", h.Magenta.Regular(val.Bin)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Build"), ":", h.Magenta.Regular(val.Build)) - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Run"), ":", h.Magenta.Regular(val.Run)) + fmt.Println(h.Blue.Bold("[") + strings.ToUpper(val.Name) + h.Blue.Bold("]")) + name := h.Magenta.Bold("[") + strings.ToUpper(val.Name) + h.Magenta.Bold("]") + + fmt.Println(name, h.Yellow.Regular("Base Path"), ":", h.Magenta.Regular(val.Path)) + fmt.Println(name, h.Yellow.Regular("Fmt"), ":", h.Magenta.Regular(val.Fmt)) + fmt.Println(name, h.Yellow.Regular("Generate"), ":", h.Magenta.Regular(val.Generate)) + fmt.Println(name, h.Yellow.Regular("Test"), ":", h.Magenta.Regular(val.Test)) + fmt.Println(name, h.Yellow.Regular("Install"), ":", h.Magenta.Regular(val.Bin)) + fmt.Println(name, h.Yellow.Regular("Build"), ":", h.Magenta.Regular(val.Build)) + fmt.Println(name, h.Yellow.Regular("Run"), ":", h.Magenta.Regular(val.Run)) if len(val.Params) > 0 { - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Params"), ":", h.Magenta.Regular(val.Params)) + fmt.Println(name, h.Yellow.Regular("Params"), ":", h.Magenta.Regular(val.Params)) } - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Watcher"), ":") - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Preview"), ":", h.Magenta.Regular(val.Watcher.Preview)) + fmt.Println(name, h.Yellow.Regular("Watcher"), ":") + fmt.Println(name, "\t", h.Yellow.Regular("Preview"), ":", h.Magenta.Regular(val.Watcher.Preview)) if len(val.Watcher.Exts) > 0 { - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Extensions"), ":", h.Magenta.Regular(val.Watcher.Exts)) + fmt.Println(name, "\t", h.Yellow.Regular("Extensions"), ":", h.Magenta.Regular(val.Watcher.Exts)) } if len(val.Watcher.Paths) > 0 { - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Paths"), ":", h.Magenta.Regular(val.Watcher.Paths)) + fmt.Println(name, "\t", h.Yellow.Regular("Paths"), ":", h.Magenta.Regular(val.Watcher.Paths)) } if len(val.Watcher.Ignore) > 0 { - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Ignored paths"), ":", h.Magenta.Regular(val.Watcher.Ignore)) + fmt.Println(name, "\t", h.Yellow.Regular("Ignored paths"), ":", h.Magenta.Regular(val.Watcher.Ignore)) } if len(val.Watcher.Scripts) > 0 { - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Scripts"), ":") + fmt.Println(name, "\t", h.Yellow.Regular("Scripts"), ":") for _, v := range val.Watcher.Scripts { if v.Command != "" { - fmt.Println(h.Magenta.Regular("|"), "\t\t\t", h.Magenta.Regular("-"), h.Yellow.Regular("Command"), ":", h.Magenta.Regular(v.Command)) + fmt.Println(name, "\t\t", h.Magenta.Regular("-"), h.Yellow.Regular("Command"), ":", h.Magenta.Regular(v.Command)) if v.Path != "" { - fmt.Println(h.Magenta.Regular("|"), "\t\t\t", h.Yellow.Regular("Path"), ":", h.Magenta.Regular(v.Path)) + fmt.Println(name, "\t\t", h.Yellow.Regular("Path"), ":", h.Magenta.Regular(v.Path)) } if v.Type != "" { - fmt.Println(h.Magenta.Regular("|"), "\t\t\t", h.Yellow.Regular("Type"), ":", h.Magenta.Regular(v.Type)) + fmt.Println(name, "\t\t", h.Yellow.Regular("Type"), ":", h.Magenta.Regular(v.Type)) } } } } - fmt.Println(h.Magenta.Regular("|"), "\t", h.Yellow.Regular("Streams"), ":") - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("Cli Out"), ":", h.Magenta.Regular(val.Streams.CliOut)) - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("File Out"), ":", h.Magenta.Regular(val.Streams.FileOut)) - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("File Log"), ":", h.Magenta.Regular(val.Streams.FileLog)) - fmt.Println(h.Magenta.Regular("|"), "\t\t", h.Yellow.Regular("File Err"), ":", h.Magenta.Regular(val.Streams.FileErr)) + fmt.Println(name, h.Yellow.Regular("Streams"), ":") + fmt.Println(name, "\t", h.Yellow.Regular("Cli Out"), ":", h.Magenta.Regular(val.Streams.CliOut)) + fmt.Println(name, "\t", h.Yellow.Regular("File Out"), ":", h.Magenta.Regular(val.Streams.FileOut)) + fmt.Println(name, "\t", h.Yellow.Regular("File Log"), ":", h.Magenta.Regular(val.Streams.FileLog)) + fmt.Println(name, "\t", h.Yellow.Regular("File Err"), ":", h.Magenta.Regular(val.Streams.FileErr)) } return nil }