rm demos, start with cli client

This commit is contained in:
probandula
2016-10-26 18:50:56 +02:00
parent e8dd03b275
commit 5b1157ab12
5 changed files with 22 additions and 90 deletions

View File

@@ -7,11 +7,18 @@ A port of [figlet](http://www.figlet.org/) to golang and fork of [getwe/figlet4g
## Installation
```
go get -u github.com/probandula/figlet4go
go get -u github.com/probandula/figlet4go/...
```
## Usage
### Command-line
You can use the `figlet4go` command in the command-line like this:
```bash
figlet4go Hello
```
For a usage instruction read the commands usage with `figlet4go -h`
### Basic
You have to create a renderer (`ascii`) and let it render the desired string through the `Render` method. After that you can simply print the returned string.
```go
@@ -72,11 +79,7 @@ The default font is `standard`. These are the builtin fonts
### Other fonts
Other fonts can mainly be found on [figlet](http://www.figlet.org). You have to load them as in [this example](#other-font).
## Use the demo
There are [demo](https://github.com/probandula/figlet4go/blob/master/demo) programs for trying out the library.
To run them, `cd` into the `demo/` directory and run `go run [filename]` on any program you want to run.
## Todo
- [ ] Cli client
- [ ] automatic the perfect char margin
- [ ] Linebreak possible?

View File

@@ -0,0 +1,13 @@
package main
import (
"fmt"
_"flag"
_"github.com/fatih/color"
_"github.com/probandula/figlet4go"
)
func main() {
fmt.Println("Hello Figlet")
}

View File

@@ -1,32 +0,0 @@
// Print a colored string with the 'standard' figlet font
package main
import (
"fmt"
"github.com/probandula/figlet4go"
// This package is used to define the colors
"github.com/fatih/color"
)
const str string = "Colored"
func main() {
ascii := figlet4go.NewAsciiRender()
// Add the colors to the options
options := figlet4go.NewRenderOptions()
options.FontColor = []color.Attribute{
color.FgGreen,
color.FgYellow,
color.FgCyan,
}
// Use the RenderOpts instead of the Render method
renderStr, err := ascii.RenderOpts(str, options)
if err != nil {
panic(err)
}
fmt.Print(renderStr)
}

View File

@@ -1,25 +0,0 @@
// 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, err := ascii.Render(str)
if err != nil {
panic(err)
}
// Print the string
fmt.Print(renderStr)
}

View File

@@ -1,27 +0,0 @@
// Print a string with another font
package main
import (
"fmt"
"github.com/probandula/figlet4go"
)
const str string = "otherfont"
func main() {
ascii := figlet4go.NewAsciiRender()
// Add the font name to the options
options := figlet4go.NewRenderOptions()
// This font is included so you don't have to specify a path with 'ascii.LoadFont(/path/to/fonts/)'
options.FontName = "larry3d"
// Use the RenderOpts instead of the Render method
renderStr, err := ascii.RenderOpts(str, options)
if err != nil {
panic(err)
}
fmt.Print(renderStr)
}