[tarantool-patches] Re: [RFC] box/lua/console: Add console.fmt module

Cyrill Gorcunov gorcunov at gmail.com
Fri Jun 21 11:16:40 MSK 2019


On Fri, Jun 21, 2019 at 10:32:41AM +0300, Konstantin Osipov wrote:
> > At the moment these two modes are supprted only.
> 
> We should have a meta command for this as well:
> 
> \set output format lua
> \set output format yaml

OK, will do.

> Are you sure we need a separate namespace for fmt, wouldn't
> console.set_format() be enough?

Because I want to separate output engine from general
console code. To me console is like a transport peer,
which includes setting up a connection to remote machine,
run evaluator and etc, but output formatter is like a
separate engine so it should live in other module. Or
you meant something else?

> > index 000000000..f860d76fb
> > --- /dev/null
> > +++ b/src/box/lua/console_fmt.lua
> > @@ -0,0 +1,295 @@
> > +-- # vim: ts=4 sw=4 et
> > +
> > +local internal = require('console')
> > +
> > +local console_formats = {
> > +    ["lua"] = nil,
> > +    ["yaml"] = nil
> > +}
> 
> Why didn't  you use a git submodule with an established Lua
> formatter?

I considered using vanilla "pretty print" or "serpent" but

1) they are too huge
2) we need own extensions for decoding own subset of keywords
   (for example box.NULL symbol)

so we simply can't use unmodified third party engines thus
better to keep own much simpler (hopefully) engine.




More information about the Tarantool-patches mailing list