From 60fe917ec11453ef7eda466a19fef9737031e5a8 Mon Sep 17 00:00:00 2001 From: honggengwei Date: Thu, 23 Oct 2014 14:56:35 +0800 Subject: [PATCH] Please use go fmt to format the code --- demo/demo.go | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/demo/demo.go b/demo/demo.go index 5990aff..fbcdffd 100644 --- a/demo/demo.go +++ b/demo/demo.go @@ -1,49 +1,49 @@ package main import ( - "fmt" - "github.com/fatih/color" - "github.com/getwe/figlet4go" - "flag" + "flag" + "fmt" + "github.com/fatih/color" + "github.com/getwe/figlet4go" ) var flag_str = flag.String("str", "golang", "input string") func main() { - flag.Parse() - str := *flag_str - ascii := figlet4go.NewAsciiRender() - // most simple Usage - renderStr, _ := ascii.Render(str) - fmt.Println(renderStr) + flag.Parse() + str := *flag_str + ascii := figlet4go.NewAsciiRender() + // most simple Usage + renderStr, _ := ascii.Render(str) + fmt.Println(renderStr) - // change the font color - colors := [...]color.Attribute{ - color.FgMagenta, - color.FgYellow, - color.FgBlue, - color.FgCyan, - color.FgRed, - color.FgWhite, - } - options := figlet4go.NewRenderOptions() - options.FontColor = make([]color.Attribute, len(str)) - for i := range options.FontColor { - options.FontColor[i] = colors[i % len(colors)] - } - renderStr, _ = ascii.RenderOpts(str, options) - fmt.Println(renderStr) + // change the font color + colors := [...]color.Attribute{ + color.FgMagenta, + color.FgYellow, + color.FgBlue, + color.FgCyan, + color.FgRed, + color.FgWhite, + } + options := figlet4go.NewRenderOptions() + options.FontColor = make([]color.Attribute, len(str)) + for i := range options.FontColor { + options.FontColor[i] = colors[i%len(colors)] + } + renderStr, _ = ascii.RenderOpts(str, options) + fmt.Println(renderStr) - // change the font - options.FontName = "larry3d" - // except the default font,others need to be load from disk - // here is the font : - // ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz - // ftp://ftp.figlet.org/pub/figlet/fonts/international.tar.gz - // download and extract to the disk,then specify the file path to load - ascii.LoadFont("/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/") + // change the font + options.FontName = "larry3d" + // except the default font,others need to be load from disk + // here is the font : + // ftp://ftp.figlet.org/pub/figlet/fonts/contributed.tar.gz + // ftp://ftp.figlet.org/pub/figlet/fonts/international.tar.gz + // download and extract to the disk,then specify the file path to load + ascii.LoadFont("/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/") - renderStr, _ = ascii.RenderOpts(str, options) - fmt.Println(renderStr) + renderStr, _ = ascii.RenderOpts(str, options) + fmt.Println(renderStr) }