31 lines
		
	
	
	
		
			568 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			568 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package nomino
 | |
| 
 | |
| type Config struct {
 | |
| 	original  string
 | |
| 	prefix    string
 | |
| 	suffix    string
 | |
| 	extension string
 | |
| 	separator string
 | |
| 	generator Generator
 | |
| }
 | |
| 
 | |
| // NewConfig returns a new Config with the specified Options.
 | |
| func NewConfig(options ...Option) Config {
 | |
| 	conf := Config{
 | |
| 		extension: ".txt",
 | |
| 		separator: "_",
 | |
| 		generator: UUID(nil),
 | |
| 	}
 | |
| 	for _, opt := range options {
 | |
| 		opt(&conf)
 | |
| 	}
 | |
| 	return conf
 | |
| }
 | |
| 
 | |
| // AddOptions creates a new Config with options added.
 | |
| func (c Config) AddOptions(options ...Option) Config {
 | |
| 	for _, opt := range options {
 | |
| 		opt(&c)
 | |
| 	}
 | |
| 	return c
 | |
| }
 |