nomino/generators_examples_test.go

28 lines
440 B
Go
Raw Normal View History

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