Library references github source & replace with local files in motd.go

This commit is contained in:
2023-08-13 20:12:05 +02:00
parent 8b69ca6de9
commit 95b12f56ea
6 changed files with 22 additions and 20 deletions

View File

@@ -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)
}

4
go.mod
View File

@@ -1,3 +1,7 @@
module motdGO
go 1.20
replace github.com/kevinmidboe/motdGO => ./
require github.com/kevinmidboe/motdGO v0.0.0-00010101000000-000000000000

2
go.sum
View File

@@ -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=

View File

@@ -1,4 +1,4 @@
package figlet4go
package motdGO
import "errors"

View File

@@ -1,4 +1,4 @@
package figlet4go
package motdGO
// RenderOptions are used to set color or maybe future
// options to the AsciiRenderer

View File

@@ -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 ./
go-bindata -o ../bindata.go -pkg motdGO ./