You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
985 B
53 lines
985 B
3 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"net/http"
|
||
|
"os"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
banner := "shadow"
|
||
|
ascii, err := http.Get("https://git.01.kood.tech/root/public/raw/branch/master/subjects/ascii-art/" + banner + ".txt")
|
||
|
|
||
|
asciiBody, err := io.ReadAll(ascii.Body)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
args := os.Args[1]
|
||
|
loopCount := 0
|
||
|
var newlinePos []int
|
||
|
var hasNewLine bool
|
||
|
asciiSplit := strings.Split(string(asciiBody), "\n")
|
||
|
for i := 0; i < 8; i++ {
|
||
|
for j := 0; j < len(args); j++ {
|
||
|
hasNewLine = false
|
||
|
if args[j] == '\\' && args[j+1] == 'n' {
|
||
|
// fmt.Println()
|
||
|
newlinePos = append(newlinePos, j)
|
||
|
|
||
|
hasNewLine = true
|
||
|
fmt.Println()
|
||
|
break
|
||
|
}
|
||
|
fmt.Printf(string(asciiSplit[(int(args[j])-32)*8+(int(args[j])-32)+i+1]))
|
||
|
|
||
|
if j == len(args)-1 {
|
||
|
fmt.Println()
|
||
|
}
|
||
|
}
|
||
|
// fmt.Println()
|
||
|
if i == 7 {
|
||
|
if hasNewLine == true {
|
||
|
fmt.Println()
|
||
|
i = 0
|
||
|
hasNewLine = false
|
||
|
args = args[newlinePos[loopCount*8]+2:]
|
||
|
loopCount++
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|