Sha256: eb6c87abf7ec951d3e3ef1f39847c9ed67fa0c05c610f69d33a761d679519cf7

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

# term_utils

Terminal utilities for ruby.

## Purpose

Provides terminal utilities like table formatting.

## Content

### Table formatting

Take the following table:

        id  string8   string16        
      ----  --------  ----------------
         1  Fiat Lux  Fiat Lux        
         2  Alea ...  Alea jacta est  
         3  Audac...  Audaces fortuna juvat
      ----  --------  ----------------
        id  string8   string16        

You can produce it with the following code:

    require 'term_utils/tab'

    TermUtils::Tab.define_table(:foo) do |t|
      t.define_column :id, :width => 4, :align => :right
      t.define_column :string8, :fixed => true, :ellipsis => "..."
      t.define_column :string16, :width => 16
    end

    data = []
    data << [1, "Fiat Lux", "Fiat Lux"]
    data << [2, "Alea jacta est", "Alea jacta est"]
    data << [3, "Audaces fortuna juvat", "Audaces fortuna juvat"]

    TermUtils::Tab.printer :foo, $stdout, :offset => 2 do |tpr|
      tpr.line
      tpr.header
      tpr.separator
      data.each do |d|
        tpr.data d
      end
      tpr.separator
      tpr.header
      tpr.line
    end

### Argument Parsing

The Argument Parsing module provides a way to parse command line arguments.

See Samples.

### File Finder

The File Finder module provides a way to query the filesystem.

See the samples.

## License

GPL-3.0-only.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
term_utils-0.3.2 README.md