mirror of
https://github.com/KevinMidboe/motdGO.git
synced 2026-07-24 02:31:57 +00:00
readme changes, other default font, go-bindata for default font, little commenting
This commit is contained in:
-25
@@ -1,25 +0,0 @@
|
|||||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
|
||||||
*.o
|
|
||||||
*.a
|
|
||||||
*.so
|
|
||||||
|
|
||||||
# Folders
|
|
||||||
_obj
|
|
||||||
_test
|
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
|
||||||
*.[568vq]
|
|
||||||
[568vq].out
|
|
||||||
|
|
||||||
*.cgo1.go
|
|
||||||
*.cgo2.c
|
|
||||||
_cgo_defun.c
|
|
||||||
_cgo_gotypes.go
|
|
||||||
_cgo_export.*
|
|
||||||
|
|
||||||
_testmain.go
|
|
||||||
|
|
||||||
*.exe
|
|
||||||
|
|
||||||
tags
|
|
||||||
*.test
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014 getwe
|
Copyright (c) 2014 getwe, 2016 probandula
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
|||||||
@@ -1,32 +1,34 @@
|
|||||||
# figlet4go
|
# FIGlet for Go
|
||||||
_______ __ _______ __ _______ .___________. _ _ _______ ______
|
|
||||||
| ____|| | / _____|| | | ____|| || || | / _____| / __ \
|
|
||||||
| |__ | | | | __ | | | |__ `---| |----`| || |_ | | __ | | | |
|
|
||||||
| __| | | | | |_ | | | | __| | | |__ _| | | |_ | | | | |
|
|
||||||
| | | | | |__| | | `----.| |____ | | | | | |__| | | `--' |
|
|
||||||
|__| |__| \______| |_______||_______| |__| |_| \______| \______/
|
|
||||||
|
|
||||||
A port of [figlet](http://www.figlet.org/) to golang.
|
**Currently in Development.
|
||||||
Make it easier to use,add some new feature such as colorized outputs.
|
Sould work but will be improved (add demos, better font adding, maybe better performance, more default fonts)**
|
||||||
|
|
||||||
|
A port of [figlet](http://www.figlet.org/) to golang and fork of [getwe/figlet4go](https://github.com/getwe/figlet4go).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
go get -u github.com/probandula/figlet4go
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
```go
|
||||||
|
// Create the renderer
|
||||||
|
ascii := figlet4go.NewAsciiRender()
|
||||||
|
|
||||||
|
// Optional: Add color to the letters (https://github.com/fatih/color needed)
|
||||||
|
|
||||||
### Install
|
// Render and print the string
|
||||||
|
renderStr, _ := ascii.Render("Hello World")
|
||||||
```
|
fmt.Print(renderStr)
|
||||||
go get -u github.com/getwe/figlet4go
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Demo
|
## Default font
|
||||||
|
The default font is built into the `bindata.go` file with the tool [go-bindata](https://github.com/jteeuwen/go-bindata).
|
||||||
|
The bash script for building the default font is stored in `tools/` (`go-bindata` must be installed).
|
||||||
|
|
||||||
```
|
## Use the demo
|
||||||
cd demo/
|
There are [demo](https://github.com/probandula/figlet4go/blob/master/demo) programs for trying out the library.
|
||||||
go build
|
To run them, `cd` into the `demo/` directory and run `go run [filename]` on any program you want to run.
|
||||||
./demo -str="golang"
|
|
||||||
#Maybe you have to `brew install figlet` if you need 3D fond in mac osx.
|
|
||||||
```
|
|
||||||
|
|
||||||
see details in `demo/demo.go` .
|
|
||||||
|
|
||||||

|
|
||||||
+2227
File diff suppressed because it is too large
Load Diff
+235
File diff suppressed because one or more lines are too long
-722
@@ -1,722 +0,0 @@
|
|||||||
package figlet4go
|
|
||||||
|
|
||||||
// Build in source font from starwars.flf
|
|
||||||
const builtInFont = `flf2a$ 7 6 22 15 4
|
|
||||||
starwars.flf by Ryan Youck (youck@cs.uregina.ca) Dec 25/1994
|
|
||||||
I am not responsible for use of this font
|
|
||||||
Based on Big.flf by Glenn Chappell
|
|
||||||
|
|
||||||
$ $@
|
|
||||||
$ $@
|
|
||||||
$ $@
|
|
||||||
$ $@
|
|
||||||
$ $@
|
|
||||||
$ $@
|
|
||||||
$ $@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
|__|$@
|
|
||||||
(__)$@
|
|
||||||
$@@
|
|
||||||
_ _ @
|
|
||||||
( | )@
|
|
||||||
V V @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
_| || |_$@
|
|
||||||
|_ __ _|@
|
|
||||||
_| || |_ @
|
|
||||||
|_ __ _|@
|
|
||||||
|_||_| $@
|
|
||||||
@@
|
|
||||||
__,--,_.@
|
|
||||||
/ |@
|
|
||||||
| (----` + "`@" + `
|
|
||||||
\ \ $@
|
|
||||||
.----) | $@
|
|
||||||
|_ __/ $@
|
|
||||||
'--' $@@
|
|
||||||
_ ___$ @
|
|
||||||
/ \ / /$ @
|
|
||||||
( o ) / / $ @
|
|
||||||
\_/ / / _$ @
|
|
||||||
/ / / \ @
|
|
||||||
/ / ( o )@
|
|
||||||
/__/ \_/ @@
|
|
||||||
@
|
|
||||||
___ @
|
|
||||||
( _ ) $@
|
|
||||||
/ _ \/\@
|
|
||||||
| (_> <@
|
|
||||||
\___/\/@
|
|
||||||
$@@
|
|
||||||
__ @
|
|
||||||
(_ )@
|
|
||||||
|/ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
___@
|
|
||||||
/ /@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
\__\@@
|
|
||||||
___ @
|
|
||||||
\ \ @
|
|
||||||
| |@
|
|
||||||
| |@
|
|
||||||
| |@
|
|
||||||
| |@
|
|
||||||
/__/ @@
|
|
||||||
_ @
|
|
||||||
/\| |/\ @
|
|
||||||
\ ` + "`" + ` ' /$@
|
|
||||||
|_ _|@
|
|
||||||
/ , . \$@
|
|
||||||
\/|_|\/ @
|
|
||||||
@@
|
|
||||||
@
|
|
||||||
_ @
|
|
||||||
_| |_$@
|
|
||||||
|_ _|@
|
|
||||||
|_| $@
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
__ @
|
|
||||||
(_ )@
|
|
||||||
|/ @@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
______ @
|
|
||||||
|______|@
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
$ @
|
|
||||||
__ @
|
|
||||||
(__)@
|
|
||||||
@@
|
|
||||||
___@
|
|
||||||
/ /@
|
|
||||||
/ / @
|
|
||||||
/ /$ @
|
|
||||||
/ /$ @
|
|
||||||
/__/$ @
|
|
||||||
@@
|
|
||||||
___ $@
|
|
||||||
/ _ \ $@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| |_| |$@
|
|
||||||
\___/ $@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
/_ |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
|_|$@
|
|
||||||
$@@
|
|
||||||
___ $@
|
|
||||||
|__ \ $@
|
|
||||||
$) |$@
|
|
||||||
/ / $@
|
|
||||||
/ /_ $@
|
|
||||||
|____|$@
|
|
||||||
$@@
|
|
||||||
____ $@
|
|
||||||
|___ \ $@
|
|
||||||
__) |$@
|
|
||||||
|__ < $@
|
|
||||||
___) |$@
|
|
||||||
|____/ $@
|
|
||||||
$@@
|
|
||||||
_ _ $@
|
|
||||||
| || | $@
|
|
||||||
| || |_ $@
|
|
||||||
|__ _|$@
|
|
||||||
| | $@
|
|
||||||
|_| $@
|
|
||||||
$@@
|
|
||||||
_____ $@
|
|
||||||
| ____|$@
|
|
||||||
| |__ $@
|
|
||||||
|___ \ $@
|
|
||||||
___) |$@
|
|
||||||
|____/ $@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
/ / $@
|
|
||||||
/ /_ $@
|
|
||||||
| '_ \ $@
|
|
||||||
| (_) |$@
|
|
||||||
\___/ $@
|
|
||||||
$@@
|
|
||||||
______ $@
|
|
||||||
|____ |$@
|
|
||||||
$/ / $@
|
|
||||||
/ / $@
|
|
||||||
/ / $@
|
|
||||||
/_/ $@
|
|
||||||
$@@
|
|
||||||
___ $@
|
|
||||||
/ _ \ $@
|
|
||||||
| (_) |$@
|
|
||||||
> _ < $@
|
|
||||||
| (_) |$@
|
|
||||||
\___/ $@
|
|
||||||
$@@
|
|
||||||
___ $@
|
|
||||||
/ _ \ $@
|
|
||||||
| (_) |$@
|
|
||||||
\__, |$@
|
|
||||||
/ / $@
|
|
||||||
/_/ $@
|
|
||||||
$@@
|
|
||||||
@
|
|
||||||
_ @
|
|
||||||
(_)@
|
|
||||||
$ @
|
|
||||||
_ @
|
|
||||||
(_)@
|
|
||||||
@@
|
|
||||||
@
|
|
||||||
_ @
|
|
||||||
(_)@
|
|
||||||
$ @
|
|
||||||
_ @
|
|
||||||
( )@
|
|
||||||
|/ @@
|
|
||||||
___@
|
|
||||||
/ /@
|
|
||||||
/ /$@
|
|
||||||
< <$ @
|
|
||||||
\ \$@
|
|
||||||
\__\@
|
|
||||||
@@
|
|
||||||
@
|
|
||||||
______ @
|
|
||||||
|______|@
|
|
||||||
______ @
|
|
||||||
|______|@
|
|
||||||
@
|
|
||||||
@@
|
|
||||||
___ @
|
|
||||||
\ \$ @
|
|
||||||
\ \ @
|
|
||||||
> >@
|
|
||||||
/ / @
|
|
||||||
/__/$ @
|
|
||||||
@@
|
|
||||||
______ $@
|
|
||||||
| \ $@
|
|
||||||
` + "`" + `----) |$@
|
|
||||||
/ / $@
|
|
||||||
|__| $@
|
|
||||||
__ $@
|
|
||||||
(__) $@@
|
|
||||||
____ @
|
|
||||||
/ __ \ @
|
|
||||||
/ / _` + "`" + ` |@
|
|
||||||
| | (_| |@
|
|
||||||
\ \__,_|@
|
|
||||||
\____/ @
|
|
||||||
@@
|
|
||||||
___ $ @
|
|
||||||
/ \ $ @
|
|
||||||
/ ^ \$ @
|
|
||||||
/ /_\ \$ @
|
|
||||||
/ _____ \$ @
|
|
||||||
/__/ \__\$@
|
|
||||||
$@@
|
|
||||||
.______ $@
|
|
||||||
| _ \ $@
|
|
||||||
| |_) |$@
|
|
||||||
| _ < $@
|
|
||||||
| |_) |$@
|
|
||||||
|______/ $@
|
|
||||||
$@@
|
|
||||||
______$@
|
|
||||||
/ |@
|
|
||||||
| ,----'@
|
|
||||||
| | $@
|
|
||||||
| ` + "`" + `----.@
|
|
||||||
\______|@
|
|
||||||
$@@
|
|
||||||
_______ $@
|
|
||||||
| \$@
|
|
||||||
| .--. |@
|
|
||||||
| | | |@
|
|
||||||
| '--' |@
|
|
||||||
|_______/$@
|
|
||||||
$@@
|
|
||||||
_______ @
|
|
||||||
| ____|@
|
|
||||||
| |__ $@
|
|
||||||
| __| $@
|
|
||||||
| |____ @
|
|
||||||
|_______|@
|
|
||||||
@@
|
|
||||||
_______ @
|
|
||||||
| ____|@
|
|
||||||
| |__ $@
|
|
||||||
| __| $@
|
|
||||||
| | $ @
|
|
||||||
|__| @
|
|
||||||
@@
|
|
||||||
_______ @
|
|
||||||
/ _____|@
|
|
||||||
| | __ $@
|
|
||||||
| | |_ |$@
|
|
||||||
| |__| |$@
|
|
||||||
\______|$@
|
|
||||||
$@@
|
|
||||||
__ __ $@
|
|
||||||
| | | |$@
|
|
||||||
| |__| |$@
|
|
||||||
| __ |$@
|
|
||||||
| | | |$@
|
|
||||||
|__| |__|$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
|__|$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
.--. | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
__ ___$@
|
|
||||||
| |/ /$@
|
|
||||||
| ' / $@
|
|
||||||
| < $@
|
|
||||||
| . \ $@
|
|
||||||
|__|\__\$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| | $@
|
|
||||||
| | $@
|
|
||||||
| | $@
|
|
||||||
| ` + "`" + `----.@
|
|
||||||
|_______|@
|
|
||||||
$@@
|
|
||||||
.___ ___.$@
|
|
||||||
| \/ |$@
|
|
||||||
| \ / |$@
|
|
||||||
| |\/| |$@
|
|
||||||
| | | |$@
|
|
||||||
|__| |__|$@
|
|
||||||
$@@
|
|
||||||
.__ __.$@
|
|
||||||
| \ | |$@
|
|
||||||
| \| |$@
|
|
||||||
| . ` + "`" + ` |$@
|
|
||||||
| |\ |$@
|
|
||||||
|__| \__|$@
|
|
||||||
$@@
|
|
||||||
______ $@
|
|
||||||
/ __ \ $@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
.______ $@
|
|
||||||
| _ \ $@
|
|
||||||
| |_) |$@
|
|
||||||
| ___/ $@
|
|
||||||
| | $ @
|
|
||||||
| _| $ @
|
|
||||||
$ @@
|
|
||||||
______ $ @
|
|
||||||
/ __ \ $ @
|
|
||||||
| | | | $ @
|
|
||||||
| | | | $ @
|
|
||||||
| ` + "`" + `--' '--. @
|
|
||||||
\_____\_____\@
|
|
||||||
$ @@
|
|
||||||
.______ $ @
|
|
||||||
| _ \ $ @
|
|
||||||
| |_) | $ @
|
|
||||||
| / $ @
|
|
||||||
| |\ \----.@
|
|
||||||
| _| ` + "`" + `._____|@
|
|
||||||
$@@
|
|
||||||
_______.@
|
|
||||||
/ |@
|
|
||||||
| (----` + "`" + `@
|
|
||||||
\ \ $@
|
|
||||||
.----) | $@
|
|
||||||
|_______/ $@
|
|
||||||
$@@
|
|
||||||
.___________.@
|
|
||||||
| |@
|
|
||||||
` + "`" + `---| |----` + "`" + `@
|
|
||||||
| | $ @
|
|
||||||
| | $ @
|
|
||||||
|__| $ @
|
|
||||||
$ @@
|
|
||||||
__ __ $@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
____ ____$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ \/ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\__/$ @
|
|
||||||
$ @@
|
|
||||||
____ __ ____$@
|
|
||||||
\ \ / \ / /$@
|
|
||||||
\ \/ \/ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\ /\ /$ @
|
|
||||||
\__/ \__/$ @
|
|
||||||
$ @@
|
|
||||||
___ ___$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ V / $@
|
|
||||||
> < $@
|
|
||||||
/ . \ $@
|
|
||||||
/__/ \__\$@
|
|
||||||
$@@
|
|
||||||
____ ____$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ \/ /$ @
|
|
||||||
\_ _/$ @
|
|
||||||
| |$ @
|
|
||||||
|__|$ @
|
|
||||||
$ @@
|
|
||||||
________ $@
|
|
||||||
| / $@
|
|
||||||
` + "`" + `---/ / $@
|
|
||||||
/ / $@
|
|
||||||
/ /----.@
|
|
||||||
/________|@
|
|
||||||
$@@
|
|
||||||
____ @
|
|
||||||
| |@
|
|
||||||
| |-` + "`" + `@
|
|
||||||
| | $@
|
|
||||||
| | $@
|
|
||||||
| |-.@
|
|
||||||
|____|@@
|
|
||||||
___ @
|
|
||||||
\ \ $ @
|
|
||||||
\ \$ @
|
|
||||||
\ \$ @
|
|
||||||
\ \$@
|
|
||||||
\__\@
|
|
||||||
@@
|
|
||||||
____ @
|
|
||||||
| |@
|
|
||||||
` + "`" + `-| |@
|
|
||||||
| |@
|
|
||||||
| |@
|
|
||||||
.-| |@
|
|
||||||
|____|@@
|
|
||||||
___ @
|
|
||||||
/ \ @
|
|
||||||
/--^--\@
|
|
||||||
$@
|
|
||||||
$@
|
|
||||||
$@
|
|
||||||
$@@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
@
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
______ @
|
|
||||||
|______|@@
|
|
||||||
__ @
|
|
||||||
( _)@
|
|
||||||
\| @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
___ $ @
|
|
||||||
/ \ $ @
|
|
||||||
/ ^ \$ @
|
|
||||||
/ /_\ \$ @
|
|
||||||
/ _____ \$ @
|
|
||||||
/__/ \__\$@
|
|
||||||
$@@
|
|
||||||
.______ $@
|
|
||||||
| _ \ $@
|
|
||||||
| |_) |$@
|
|
||||||
| _ < $@
|
|
||||||
| |_) |$@
|
|
||||||
|______/ $@
|
|
||||||
$@@
|
|
||||||
______$@
|
|
||||||
/ |@
|
|
||||||
| ,----'@
|
|
||||||
| | $@
|
|
||||||
| ` + "`" + `----.@
|
|
||||||
\______|@
|
|
||||||
$@@
|
|
||||||
_______ $@
|
|
||||||
| \$@
|
|
||||||
| .--. |@
|
|
||||||
| | | |@
|
|
||||||
| '--' |@
|
|
||||||
|_______/$@
|
|
||||||
$@@
|
|
||||||
_______ @
|
|
||||||
| ____|@
|
|
||||||
| |__ $@
|
|
||||||
| __| $@
|
|
||||||
| |____ @
|
|
||||||
|_______|@
|
|
||||||
@@
|
|
||||||
_______ @
|
|
||||||
| ____|@
|
|
||||||
| |__ $@
|
|
||||||
| __| $@
|
|
||||||
| | $ @
|
|
||||||
|__| @
|
|
||||||
@@
|
|
||||||
_______ @
|
|
||||||
/ _____|@
|
|
||||||
| | __ $@
|
|
||||||
| | |_ |$@
|
|
||||||
| |__| |$@
|
|
||||||
\______|$@
|
|
||||||
$@@
|
|
||||||
__ __ $@
|
|
||||||
| | | |$@
|
|
||||||
| |__| |$@
|
|
||||||
| __ |$@
|
|
||||||
| | | |$@
|
|
||||||
|__| |__|$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
|__|$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
.--. | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
__ ___$@
|
|
||||||
| |/ /$@
|
|
||||||
| ' / $@
|
|
||||||
| < $@
|
|
||||||
| . \ $@
|
|
||||||
|__|\__\$@
|
|
||||||
$@@
|
|
||||||
__ $@
|
|
||||||
| | $@
|
|
||||||
| | $@
|
|
||||||
| | $@
|
|
||||||
| ` + "`" + `----.@
|
|
||||||
|_______|@
|
|
||||||
$@@
|
|
||||||
.___ ___.$@
|
|
||||||
| \/ |$@
|
|
||||||
| \ / |$@
|
|
||||||
| |\/| |$@
|
|
||||||
| | | |$@
|
|
||||||
|__| |__|$@
|
|
||||||
$@@
|
|
||||||
.__ __.$@
|
|
||||||
| \ | |$@
|
|
||||||
| \| |$@
|
|
||||||
| . ` + "`" + ` |$@
|
|
||||||
| |\ |$@
|
|
||||||
|__| \__|$@
|
|
||||||
$@@
|
|
||||||
______ $@
|
|
||||||
/ __ \ $@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
.______ $@
|
|
||||||
| _ \ $@
|
|
||||||
| |_) |$@
|
|
||||||
| ___/ $@
|
|
||||||
| | $ @
|
|
||||||
| _| $ @
|
|
||||||
$ @@
|
|
||||||
______ $ @
|
|
||||||
/ __ \ $ @
|
|
||||||
| | | | $ @
|
|
||||||
| | | | $ @
|
|
||||||
| ` + "`" + `--' '--. @
|
|
||||||
\_____\_____\@
|
|
||||||
$ @@
|
|
||||||
.______ $ @
|
|
||||||
| _ \ $ @
|
|
||||||
| |_) | $ @
|
|
||||||
| / $ @
|
|
||||||
| |\ \----.@
|
|
||||||
| _| ` + "`" + `._____|@
|
|
||||||
$@@
|
|
||||||
_______.@
|
|
||||||
/ |@
|
|
||||||
| (----` + "`" + `@
|
|
||||||
\ \ $@
|
|
||||||
.----) | $@
|
|
||||||
|_______/ $@
|
|
||||||
$@@
|
|
||||||
.___________.@
|
|
||||||
| |@
|
|
||||||
` + "`" + `---| |----` + "`" + `@
|
|
||||||
| | $ @
|
|
||||||
| | $ @
|
|
||||||
|__| $ @
|
|
||||||
$ @@
|
|
||||||
__ __ $@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| | | |$@
|
|
||||||
| ` + "`" + `--' |$@
|
|
||||||
\______/ $@
|
|
||||||
$@@
|
|
||||||
____ ____$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ \/ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\__/$ @
|
|
||||||
$ @@
|
|
||||||
____ __ ____$@
|
|
||||||
\ \ / \ / /$@
|
|
||||||
\ \/ \/ /$ @
|
|
||||||
\ /$ @
|
|
||||||
\ /\ /$ @
|
|
||||||
\__/ \__/$ @
|
|
||||||
$ @@
|
|
||||||
___ ___$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ V / $@
|
|
||||||
> < $@
|
|
||||||
/ . \ $@
|
|
||||||
/__/ \__\$@
|
|
||||||
$@@
|
|
||||||
____ ____$@
|
|
||||||
\ \ / /$@
|
|
||||||
\ \/ /$ @
|
|
||||||
\_ _/$ @
|
|
||||||
| |$ @
|
|
||||||
|__|$ @
|
|
||||||
$ @@
|
|
||||||
________ $@
|
|
||||||
| / $@
|
|
||||||
` + "`" + `---/ / $@
|
|
||||||
/ / $@
|
|
||||||
/ /----.@
|
|
||||||
/________|@
|
|
||||||
$@@
|
|
||||||
___@
|
|
||||||
/ /@
|
|
||||||
| |$@
|
|
||||||
/ /$ @
|
|
||||||
\ \$ @
|
|
||||||
| |$@
|
|
||||||
\__\@@
|
|
||||||
__ $@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
| |$@
|
|
||||||
|__|$@@
|
|
||||||
___ @
|
|
||||||
\ \$ @
|
|
||||||
| | @
|
|
||||||
\ \@
|
|
||||||
/ /@
|
|
||||||
| | @
|
|
||||||
/__/$ @@
|
|
||||||
__ _ @
|
|
||||||
/ \/ |@
|
|
||||||
|_/\__/ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
$ @
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_)_(_) @
|
|
||||||
/ \ @
|
|
||||||
/ _ \ @
|
|
||||||
/ ___ \ @
|
|
||||||
/_/ \_\@
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_)_(_)@
|
|
||||||
/ _ \ @
|
|
||||||
| | | |@
|
|
||||||
| |_| |@
|
|
||||||
\___/ @
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_) (_)@
|
|
||||||
| | | |@
|
|
||||||
| | | |@
|
|
||||||
| |_| |@
|
|
||||||
\___/ @
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_) (_)@
|
|
||||||
__ _ @
|
|
||||||
/ _` + "`" + ` |@
|
|
||||||
| (_| |@
|
|
||||||
\__,_|@
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_) (_)@
|
|
||||||
___ @
|
|
||||||
/ _ \ @
|
|
||||||
| (_) |@
|
|
||||||
\___/ @
|
|
||||||
@@
|
|
||||||
_ _ @
|
|
||||||
(_) (_)@
|
|
||||||
_ _ @
|
|
||||||
| | | |@
|
|
||||||
| |_| |@
|
|
||||||
\__,_|@
|
|
||||||
@@
|
|
||||||
___ @
|
|
||||||
/ _ \ @
|
|
||||||
| | ) |@
|
|
||||||
| |< < @
|
|
||||||
| | ) |@
|
|
||||||
| ||_/ @
|
|
||||||
|_| @@`
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package main
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// Print a simple string with the 'standard' figlet font
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/probandula/figlet4go"
|
||||||
|
)
|
||||||
|
|
||||||
|
// String to be printed
|
||||||
|
const str string = "Default"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Create the renderer
|
||||||
|
ascii := figlet4go.NewAsciiRender()
|
||||||
|
|
||||||
|
// Render the string
|
||||||
|
renderStr, _ := ascii.Render(str)
|
||||||
|
|
||||||
|
// Print the string
|
||||||
|
fmt.Print(renderStr)
|
||||||
|
}
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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)
|
|
||||||
|
|
||||||
// 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/")
|
|
||||||
|
|
||||||
renderStr, _ = ascii.RenderOpts(str, options)
|
|
||||||
fmt.Println(renderStr)
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,20 +9,22 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Represents a single font
|
||||||
type font struct {
|
type font struct {
|
||||||
hardblank string
|
hardblank string
|
||||||
height int
|
height int
|
||||||
fontSlice []string
|
fontSlice []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Holds the fonts
|
||||||
type fontManager struct {
|
type fontManager struct {
|
||||||
// font library
|
// Font libraries
|
||||||
fontLib map[string]*font
|
fontLib map[string]*font
|
||||||
|
// Font name to path
|
||||||
// font name to path
|
|
||||||
fontList map[string]string
|
fontList map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create new fontmanager
|
||||||
func newFontManager() *fontManager {
|
func newFontManager() *fontManager {
|
||||||
this := &fontManager{}
|
this := &fontManager{}
|
||||||
|
|
||||||
@@ -33,7 +35,7 @@ func newFontManager() *fontManager {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk through the path, load all the *.flf font file
|
// Load all font *.flf files in the fontPath recursivly
|
||||||
func (this *fontManager) loadFont(fontPath string) error {
|
func (this *fontManager) loadFont(fontPath string) error {
|
||||||
|
|
||||||
return filepath.Walk(fontPath, func(path string, info os.FileInfo, err error) error {
|
return filepath.Walk(fontPath, func(path string, info os.FileInfo, err error) error {
|
||||||
@@ -51,8 +53,14 @@ func (this *fontManager) loadFont(fontPath string) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the default font
|
||||||
func (this *fontManager) loadBuildInFont() error {
|
func (this *fontManager) loadBuildInFont() error {
|
||||||
font, err := this.parseFontContent(builtInFont)
|
fontStr, err := Asset("standard.flf")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
font, err := this.parseFontContent(string(fontStr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -60,6 +68,7 @@ func (this *fontManager) loadBuildInFont() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load a font from disk
|
||||||
func (this *fontManager) loadDiskFont(fontName string) error {
|
func (this *fontManager) loadDiskFont(fontName string) error {
|
||||||
|
|
||||||
fontFilePath, ok := this.fontList[fontName]
|
fontFilePath, ok := this.fontList[fontName]
|
||||||
@@ -82,6 +91,7 @@ func (this *fontManager) loadDiskFont(fontName string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse a font from a content string
|
||||||
func (this *fontManager) parseFontContent(cont string) (*font, error) {
|
func (this *fontManager) parseFontContent(cont string) (*font, error) {
|
||||||
lines := strings.Split(cont, "\n")
|
lines := strings.Split(cont, "\n")
|
||||||
if len(lines) < 1 {
|
if len(lines) < 1 {
|
||||||
@@ -113,6 +123,7 @@ func (this *fontManager) parseFontContent(cont string) (*font, error) {
|
|||||||
return font, nil
|
return font, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a font by name
|
||||||
func (this *fontManager) getFont(fontName string) (*font, error) {
|
func (this *fontManager) getFont(fontName string) (*font, error) {
|
||||||
font, ok := this.fontLib[fontName]
|
font, ok := this.fontLib[fontName]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.0 KiB |
Executable
+4
@@ -0,0 +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 ./
|
||||||
Reference in New Issue
Block a user