30 lines
		
	
	
	
		
			547 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			547 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package nomino_test
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	"codeberg.org/danjones000/nomino"
 | |
| )
 | |
| 
 | |
| func ExampleMake_basic() {
 | |
| 	// Use default config
 | |
| 	out, _ := nomino.Make(nomino.NewConfig())
 | |
| 	fmt.Println(out)
 | |
| }
 | |
| 
 | |
| func ExampleMake_withExtraOptions() {
 | |
| 	gen := nomino.Incremental()
 | |
| 	conf := nomino.NewConfig(
 | |
| 		nomino.WithGenerator(gen),
 | |
| 		nomino.WithPrefix("pre"),
 | |
| 	)
 | |
| 
 | |
| 	st, _ := nomino.Make(conf, nomino.WithOriginal("foobar"))
 | |
| 	fmt.Println(st)
 | |
| 	st, _ = nomino.Make(conf, nomino.WithOriginal("baz"))
 | |
| 	fmt.Println(st)
 | |
| 
 | |
| 	// Output:
 | |
| 	// pre_0_foobar.txt
 | |
| 	// pre_1_baz.txt
 | |
| }
 |