nomino/generators_examples_test.go

27 lines
440 B
Go

package nomino_test
import (
"fmt"
"codeberg.org/danjones000/nomino"
)
func ExampleWithGenerator_customGenerator() {
gen := func(*nomino.Config) (string, error) {
return "hello", nil
}
option := nomino.WithGenerator(gen)
str, _ := nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
str, _ = nomino.Make(nomino.NewConfig(
option,
nomino.WithoutExtension(),
))
fmt.Println(str)
// Output:
// hello.txt
// hello
}