The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

pretty - Format data structure prettily

VERSION

version 0.02

SYNOPSIS

Usage:

 % pretty [OPTIONS] < INPUT

Examples:

 % echo '[1..5]' | pretty -i perl
 .----.
 |  1 |
 |  2 |
 |  3 |
 |  4 |
 |  5 |
 `----'

 % cat celine-dion-album-sales.json
 [
   {
     "lang": "en",
     "sales": 3000000,
     "title": "unison",
     "year": 1990
   },
   {
     "lang": "en",
     "sales": 5300000,
     "title": "celine dion",
     "year": 1992
   },
   {
     "lang": "en",
     "sales": 16600000,
     "title": "the color of my love",
     "year": 1993
   },
   ...
 ]

 % pretty celine-dion-album-sales.json
 .--------------------------------------------------------------.
 | lang      sales   tags        title                     year |
 |                                                              |
 | en      3000000               unison                    1990 |
 | en      5300000               celine dion               1992 |
 | en     16600000               the color of my love      1993 |
 | en     30300000               falling into you          1996 |
 | en     32100000               let's talk about love     1997 |
 | en     12100000   christmas   these are special times   1998 |
 | en     10500000               a new day has come        2002 |
 | en      5100000               one heart                 2003 |
 | en      2600000               miracle                   2004 |
 | en      3400000               taking chances            2007 |
 | en      1300000               loved me back to life     2013 |
 `--------------------------------------------------------------'

DESCRIPTION

This script formats data structure using Data::Format::Pretty. You can use it to quickly visualize a data structure on a console. See documentation of Data::FOrmat::Pretty for more details.

It accepts input as JSON, or several other alternative formats (see the -i option). It by default outputs the data using the Console formatter module, but you can use the other modules.

OPTIONS

  • --input=STR, -i

    Pick input format. Available formats: json (parsed using JSON), yaml (parsed using YAML::Syck), perl. Default is json.

  • --output=STR, -o

    Pick output format. Available formats: json, yaml, perl, or any of the available Data::Format::Pretty::* (for example, specifying Ruby will use the Data::Format::Pretty::Ruby formatter module).

EXIT CODES

0 on success.

99 on command-line options error.

TODO

Pass formatting option to formatter modules.

Autodetect input format.

FAQ

SEE ALSO

Data::Format::Pretty

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-pretty.

SOURCE

Source repository is at https://github.com/sharyanto/perl-App-pretty.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-pretty

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.