Code Monkey home page Code Monkey logo

formatador's People

Contributors

amatsuda avatar beanieboi avatar bmorrall avatar cdlm avatar dependabot[bot] avatar esse avatar gabetax avatar geemus avatar howech avatar lgn21st avatar lodestone avatar manther avatar michaelmior avatar mikoto2000 avatar nirvdrum avatar olleolleolle avatar sawanoboly avatar swamp09 avatar takanamito avatar temujin9 avatar ytkg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

formatador's Issues

Allow display of a row index

I'm constructing a DataFrame gem for ruby called daru, and it involves row and column indexed data structures.

Currently I've rolled my own version of #inspect to display a DataFrame in the console (somewhat) pretty, but if support for single level and hierarchical row indexing could be added to Formatador in the future then that would be fantastic!

make a new release?

Hi,
I noticed that the last release on rubygems is quite old and has no license specified. This is already fixed in the master branch. Could you publish a new release please?

Allow to send color codes even if no tty

Sometimes we need to send the color codes to log files, or stdout is replaced by a logging process like daemontools. Formatador needs an option to force the color codes.

Thanks.

Empty lines in a simple table

Hi,

I don't know if it is a issue, but I can't fix a problem I got with my own code, please forgive me if it isn't an issue :s

formatador

The problem is fairly simple, it is a simple table, only containing simple hashes, as it doesn't got any linking, it is displayed on several lines. But I couldn't find any formatador option to fix it.

Formatador.display_compact_table(@clients_array)

Thanks you for your work and for having read.

uninitialized constant StringIO while running tests

Hi,
I am not sure if I am running tests correctly, but I keep getting this error:

Formatador
#display_table([{:a => 1}, {:a => 2}]) - returns " +---+\n | \e[1ma\e[0m |\n +---+\n | 1 |\n +---+\n | 2 |\n +---+\n"
uninitialized constant StringIO (NameError)
./tests/tests_helper.rb:9:in `capture_stdout'
./tests/table_tests.rb:14
(...)

A simple fix is to add "requires 'stringio'" to tests_helper.rb. Am I missing something, or is this require needed for the tests to work properly?

Thank you very much,
Bohuslav Kabrda.

Rewrite headers to desired output

Hi,
I am having a small issue seeing how I can add a custom header of my own onto this.

The reason being is that I hit a third party API and instead of it return a JSON object with a key of "nickname", I would like it to be "username" instead. I could iterate over the response and create a new object from the response but I would like to avoid extra handling where possible.

Any help would be appreciated!

Add License information to gemfile

This will make it show up on rubygems.org. I'm doing due diligence on our gems and need to find out the licenses for all the gems. Having it show up on rubygems.org cuts out the step of having to go to the github repo.

Tests fail when redirected to a file

Hi,
I just found out, that when you redirect the test output to a file, the 3 table tests fail, because you don't do the formatting. For example:

display_table([{:a => 1}, {:a => 2}]) - returns " +---+\n | \e[1ma\e[0m |\n +---+\n | 1 |\n +---+\n | 2 |\n +---+\n"

  expected => "    +---+\n    | \e[1ma\e[0m |\n    +---+\n    | 1 |\n    +---+\n    | 2 |\n    +---+\n"
  returned => "    +---+\n    | a |\n    +---+\n    | 1 |\n    +---+\n    | 2 |\n    +---+\n"

I believe that this is not an issue with formatador itself, but with the tests. I think they should react to the situation when redirected to a file.

Thanks,
Bohuslav Kabrda.

Decouple From Terminal + Add HTML / Spreadsheets Output?

Hi! Nice gem.

I'm on a project that us going to use some Presenters to render tabularized info to HTML and spreadsheets... a pretty common task.

But, instead of writing it as yet another small clump of template presentation code, we'd like to do it as a gem. Yours came up as an example of a tool that operates on a similar input /output mapping, though (currently) it is only for ANSI/stdout.

What would you think of a refactoring that separated it so yoy could conveniently swap rendering targets, and maybe threw in some other spiffups, like totals?

We could do most of the code+tests, but it would be nice for that work to have a proper home.

Thanks!

Is there a way to right-justify a numeric

I want to right-justify a numeric.

example:

table_data = [
  { :name => "Burger", :price => 200 },
  { :name => "French fries", :price => 120 }
]
Formatador.display_table(table_data)

#=>  +--------------+-------+
#    | name         | price |
#    +--------------+-------+
#    | Burger       |   200 |
#    +--------------+-------+
#    | French fries |   120 |
#    +--------------+-------+

Semantic Versioning

Are there plans on using Semantic Versioning for formatador? http://semver.org/

I was updating my version of the fog gem and having a 1.0 release of formatador would have helped make me more confident that upgrading wouldn't introduce any breaking changes

Better visualization on README

The idea is to use the syntax specification that Markdown allows for a better visualization of the code (and even results).

Here an example of how it would look like:

total    = 1000
progress = ProgressBar.new(total)
1000.times do
 progress.increment
end

#=> 978/1000  |************************************************* |

# Change the color of the bar
total    = 1000
progress = ProgressBar.new(total, :color => "light_blue")
1000.times do
 progress.increment
end

# Change the color of a completed progress bar
total    = 1000
progress = ProgressBar.new(total) { |b| b.opts[:color] = "green" }
1000.times do
 progress.increment
end

Allow renaming of headers in display_table

Would you consider a patch would allow a hash to be passed as the second argument to display_table so an alternate name could be given for columns? Currently I don't think this is possible without renaming all the keys in each hash.

Here's an example:

  table_data = [
    {:name => "Joe", :meal => {:main_dish => "Burger", :drink => "water"}}, 
    {:name => "Bill", :meal => {:main_dish => "Chicken", :drink => "soda"}}
  ]
  Formatador.display_table(table_data, {"name": "Name", "meal.drink": "Drink"})

  +------+------------+
  | Name | Drink      |
  +------+------------+
  | Joe  | water      |
  +------+------------+
  | Bill | soda       |
  +------+------------+

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.