tabular-formatted-view: tabular-formatted-view lib

View some data in simple color tabular form in Windows console

Installation and usage

Install:

gem install tabular-formatted-view

Usage:

    # initialize view
    tfv = Viewing::TabularFormattedView.new

    # show view with header, fields and options
    header =  "field 1 p1|field 2 p1|field n\nfield 1 p2|field 2 p2|_\n      HEAD\n    fields = [\n      { name: 'field 1', max_width: 10, just: 'left' },\n      { name: 'field 2', max_width: 7, just: 'right' },\n      { name: 'field n', max_width: 10, format: '%10.2f', just: 'center' }\n    ]\n    opts = { title_lines: ['line 1','line 2','line n'] }\n    tfv.show(header.split(\"\\n\"),fields,opts)\n\n    # you can initialize and start view proxy\n    # vp = Viewing::ViewProxy.new(tfv)\n    # vp.update('view')\n\n    # store data in view\n    values = ['id 1','abc',0.1]\n    id = values[0]\n    opts = { data_color_style: Kernel32Lib::FOREGROUND_GREEN | Kernel32Lib::FOREGROUND_INTENSITY | Kernel32Lib::BACKGROUND_BLUE}\n    # vp.store(id,values,opts)\n    tfv.store(id,values,opts)\n\n    # update view\n    # vp.update\n    tfv.update\n\n    # close view\n    # vp.close\n    tfv.close\n"

More detailed example in ./fixtures/fixture_tabular_formatted_view.rb

Troubleshooting

Visit to tabular-formatted-view homepage