diff --git a/README.md b/README.md index 2116d38..e47e7ee 100644 --- a/README.md +++ b/README.md @@ -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? \ No newline at end of file diff --git a/cmd/figlet4go/figlet4go.go b/cmd/figlet4go/figlet4go.go new file mode 100644 index 0000000..ef8a136 --- /dev/null +++ b/cmd/figlet4go/figlet4go.go @@ -0,0 +1,13 @@ +package main + +import ( + "fmt" + _"flag" + _"github.com/fatih/color" + _"github.com/probandula/figlet4go" +) + + +func main() { + fmt.Println("Hello Figlet") +} \ No newline at end of file diff --git a/demo/colored.go b/demo/colored.go deleted file mode 100644 index 280d87b..0000000 --- a/demo/colored.go +++ /dev/null @@ -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) -} diff --git a/demo/default.go b/demo/default.go deleted file mode 100644 index 30e14b5..0000000 --- a/demo/default.go +++ /dev/null @@ -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) -} diff --git a/demo/otherfont.go b/demo/otherfont.go deleted file mode 100644 index c46eb71..0000000 --- a/demo/otherfont.go +++ /dev/null @@ -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) -}