package cmdn import ( "git.noahlan.cn/noahlan/ntool/ndef" "time" ) func WithSerializer(serializer ndef.Serializer) Option { return func(opt *Options) { opt.Marshaler = &ndef.MarshalerWrapper{Marshaler: serializer} opt.Unmarshaler = &ndef.UnmarshalerWrapper{Unmarshaler: serializer} } } func WithMarshaler(marshaler ndef.Marshaler) Option { return func(opt *Options) { opt.Marshaler = marshaler } } func WithUnmarshaler(unmarshaler ndef.Unmarshaler) Option { return func(opt *Options) { opt.Unmarshaler = unmarshaler } } func WithStartupDecidedFunc(startupDecidedFunc LineFunc) Option { return func(opt *Options) { opt.StartupDecidedFunc = startupDecidedFunc } } func WithEndLineDecidedFunc(endLineDecidedFunc LineFunc) Option { return func(opt *Options) { opt.EndLineDecidedFunc = endLineDecidedFunc } } func WithReadIDFunc(readIDFunc ReadIDFunc) Option { return func(opt *Options) { opt.ReadIDFunc = readIDFunc } } func WithTimeout(timeout time.Duration) Option { return func(opt *Options) { opt.Timeout = timeout } }