From 95b12f56eabc9c66cd801a95d3663e6dc45d2f80 Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Sun, 13 Aug 2023 20:12:05 +0200 Subject: [PATCH] Library references github source & replace with local files in motd.go --- cmd/motdGO/main.go | 30 +++++++++++++++--------------- go.mod | 4 ++++ go.sum | 2 -- parser.go | 2 +- render.go | 2 +- tools/build-default-font.sh | 2 +- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/cmd/motdGO/main.go b/cmd/motdGO/main.go index fb3fd05..d5dc755 100644 --- a/cmd/motdGO/main.go +++ b/cmd/motdGO/main.go @@ -26,8 +26,8 @@ func main() { validate() // Create objects - ascii := figlet4go.NewAsciiRender() - options := figlet4go.NewRenderOptions() + ascii := motdGO.NewAsciiRender() + options := motdGO.NewRenderOptions() // Load fonts if *fontpath != "" { @@ -38,9 +38,9 @@ func main() { options.FontName = *font // Set the parser - p, err := figlet4go.GetParser(*parser) + p, err := motdGO.GetParser(*parser) if err != nil { - p, _ = figlet4go.GetParser("terminal") + p, _ = motdGO.GetParser("terminal") } options.Parser = *p @@ -79,33 +79,33 @@ func main() { // Get a slice with colors to give to the RenderOptions // Splits the given string with the separator ";" -func getColorSlice(colorStr string) []figlet4go.Color { +func getColorSlice(colorStr string) []motdGO.Color { givenColors := strings.Split(colorStr, ";") - colors := make([]figlet4go.Color, len(givenColors)) + colors := make([]motdGO.Color, len(givenColors)) for i, c := range givenColors { switch c { case "black": - colors[i] = figlet4go.ColorBlack + colors[i] = motdGO.ColorBlack case "red": - colors[i] = figlet4go.ColorRed + colors[i] = motdGO.ColorRed case "green": - colors[i] = figlet4go.ColorGreen + colors[i] = motdGO.ColorGreen case "yellow": - colors[i] = figlet4go.ColorYellow + colors[i] = motdGO.ColorYellow case "blue": - colors[i] = figlet4go.ColorBlue + colors[i] = motdGO.ColorBlue case "magenta": - colors[i] = figlet4go.ColorMagenta + colors[i] = motdGO.ColorMagenta case "cyan": - colors[i] = figlet4go.ColorCyan + colors[i] = motdGO.ColorCyan case "white": - colors[i] = figlet4go.ColorWhite + colors[i] = motdGO.ColorWhite default: // Try to parse the TrueColor from the string - color, err := figlet4go.NewTrueColorFromHexString(c) + color, err := motdGO.NewTrueColorFromHexString(c) if err != nil { log.Fatal(err) } diff --git a/go.mod b/go.mod index 01cc054..54ec294 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,7 @@ module motdGO go 1.20 + +replace github.com/kevinmidboe/motdGO => ./ + +require github.com/kevinmidboe/motdGO v0.0.0-00010101000000-000000000000 diff --git a/go.sum b/go.sum index 64a941a..e69de29 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +0,0 @@ -github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea h1:mQncVDBpKkAecPcH2IMGpKUQYhwowlafQbfkz2QFqkc= -github.com/mbndr/figlet4go v0.0.0-20190224160619-d6cef5b186ea/go.mod h1:QzTGLGoOqLHUBK8/EZ0v4Fa4CdyXmdyRwCHcl0YbeO4= diff --git a/parser.go b/parser.go index 670cea1..ab50a6d 100644 --- a/parser.go +++ b/parser.go @@ -1,4 +1,4 @@ -package figlet4go +package motdGO import "errors" diff --git a/render.go b/render.go index 91a24dd..2403f88 100644 --- a/render.go +++ b/render.go @@ -1,4 +1,4 @@ -package figlet4go +package motdGO // RenderOptions are used to set color or maybe future // options to the AsciiRenderer diff --git a/tools/build-default-font.sh b/tools/build-default-font.sh index 2f31506..57bc5d2 100755 --- a/tools/build-default-font.sh +++ b/tools/build-default-font.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Build the bindata.go file with the default font in it cd ../assets -go-bindata -o ../bindata.go -pkg figlet4go ./ \ No newline at end of file +go-bindata -o ../bindata.go -pkg motdGO ./