You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ntool/ncmd/options.go

53 lines
919 B
Go

package ncmd
import (
"git.noahlan.cn/noahlan/ntool/ndef"
)
func WithOptions(o *Options) Option {
return func(opt *Options) {
opt.Marshaler = o.Marshaler
opt.DevMode = o.DevMode
opt.Buffered = o.Buffered
opt.Streaming = o.Streaming
opt.LineBufferSize = o.LineBufferSize
opt.CombinedOutput = o.CombinedOutput
}
}
func WithMarshaler(marshaler ndef.Marshaler) Option {
return func(opt *Options) {
opt.Marshaler = marshaler
}
}
func WithBuffered(v bool) Option {
return func(opt *Options) {
opt.Buffered = v
}
}
func WithCombinedOutput() Option {
return func(opt *Options) {
opt.CombinedOutput = true
}
}
func WithStreaming() Option {
return func(opt *Options) {
opt.Streaming = true
}
}
func WithLineBufferSize(size uint) Option {
return func(opt *Options) {
opt.LineBufferSize = size
}
}
func WithDevMode(val bool) Option {
return func(opt *Options) {
opt.DevMode = val
}
}