43 lines
		
	
	
		
			584 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			584 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package settings
 | |
| 
 | |
| import "github.com/fsnotify/fsnotify"
 | |
| 
 | |
| type BackHandle func(fsnotify.Event)
 | |
| 
 | |
| type options struct {
 | |
| 	name  string
 | |
| 	ctype string
 | |
| 	path  string
 | |
| 	cb    BackHandle
 | |
| }
 | |
| 
 | |
| type Option func(*options)
 | |
| 
 | |
| func (o *options)repair(){
 | |
| 	
 | |
| }
 | |
| 
 | |
| func WithName(name string) Option {
 | |
| 	return func(o *options) {
 | |
| 		o.name = name
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func WithType(ctype string) Option {
 | |
| 	return func(o *options) {
 | |
| 		o.ctype = ctype
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func WithPath(path string) Option {
 | |
| 	return func(o *options) {
 | |
| 		o.path = path
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func WithCallBack(cb BackHandle) Option {
 | |
| 	return func(o *options) {
 | |
| 		o.cb = cb
 | |
| 	}
 | |
| }
 |