feat: init Formatter
parent
338e835b9c
commit
164bd6b6e8
|
@ -0,0 +1,22 @@
|
||||||
|
package imports
|
||||||
|
|
||||||
|
type Formatter struct {
|
||||||
|
isList bool
|
||||||
|
isWrite bool
|
||||||
|
isDiff bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFormmater(opts ...FormatterOptionFn) *Formatter {
|
||||||
|
f := &Formatter{}
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accept a list of files or directories aka fsNames
|
||||||
|
func (f *Formatter) Format(fsNames ...string) error {
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package imports
|
||||||
|
|
||||||
|
type FormatterOptionFn func(*Formatter)
|
||||||
|
|
||||||
|
func FormatterWithList() FormatterOptionFn {
|
||||||
|
return func(f *Formatter) {
|
||||||
|
f.isList = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func FormatterWithWrite() FormatterOptionFn {
|
||||||
|
return func(f *Formatter) {
|
||||||
|
f.isWrite = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func FormatterWithDiff() FormatterOptionFn {
|
||||||
|
return func(f *Formatter) {
|
||||||
|
f.isDiff = true
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue