项目作者: emsk

项目描述 :
Formatter for `brew outdated --verbose` command
高级语言: Ruby
项目地址: git://github.com/emsk/brew_outdated_formatter.git
创建时间: 2017-11-01T08:20:33Z
项目社区:https://github.com/emsk/brew_outdated_formatter

开源协议:MIT License

下载


BrewOutdatedFormatter

Gem Version
Build Status
Build Status
Build status
Codecov
Maintainability
Inline docs
License

BrewOutdatedFormatter is a command-line tool to format output of brew outdated --verbose.

Installation

Add this line to your application’s Gemfile:

  1. gem 'brew_outdated_formatter'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install brew_outdated_formatter

Usage

  1. $ brew outdated --verbose | brof

Command Options

Option Alias Description Default
--format -f Format. terminal, markdown, json, yaml, csv, tsv, xml, or html. terminal
--pretty -p true if pretty output.
This option is available in json, xml, or html formats.
false

Examples

Output of brew outdated --verbose:

  1. test1 (0.0.1) < 0.1
  2. test2 (0.0.2) < 0.1 [pinned at 0.0.2]
  3. test3 (10.10.1_1) < 11.0.1_1

Convert to Terminal

  1. +---------+-----------+----------+--------+
  2. | formula | installed | current | pinned |
  3. +---------+-----------+----------+--------+
  4. | test1 | 0.0.1 | 0.1 | |
  5. | test2 | 0.0.2 | 0.1 | 0.0.2 |
  6. | test3 | 10.10.1_1 | 11.0.1_1 | |
  7. +---------+-----------+----------+--------+

Convert to Markdown

  1. | formula | installed | current | pinned |
  2. | --- | --- | --- | --- |
  3. | test1 | 0.0.1 | 0.1 | |
  4. | test2 | 0.0.2 | 0.1 | 0.0.2 |
  5. | test3 | 10.10.1_1 | 11.0.1_1 | |

Convert to JSON

Normal output:

  1. [{"formula":"test1","installed":"0.0.1","current":"0.1","pinned":""},{"formula":"test2","installed":"0.0.2","current":"0.1","pinned":"0.0.2"},{"formula":"test3","installed":"10.10.1_1","current":"11.0.1_1","pinned":""}]

Pretty output:

  1. [
  2. {
  3. "formula": "test1",
  4. "installed": "0.0.1",
  5. "current": "0.1",
  6. "pinned": ""
  7. },
  8. {
  9. "formula": "test2",
  10. "installed": "0.0.2",
  11. "current": "0.1",
  12. "pinned": "0.0.2"
  13. },
  14. {
  15. "formula": "test3",
  16. "installed": "10.10.1_1",
  17. "current": "11.0.1_1",
  18. "pinned": ""
  19. }
  20. ]

Convert to YAML

  1. ---
  2. - formula: test1
  3. installed: 0.0.1
  4. current: '0.1'
  5. pinned: ''
  6. - formula: test2
  7. installed: 0.0.2
  8. current: '0.1'
  9. pinned: 0.0.2
  10. - formula: test3
  11. installed: 10.10.1_1
  12. current: 11.0.1_1
  13. pinned: ''

Convert to CSV

  1. "formula","installed","current","pinned"
  2. "test1","0.0.1","0.1",""
  3. "test2","0.0.2","0.1","0.0.2"
  4. "test3","10.10.1_1","11.0.1_1",""

Convert to TSV

  1. "formula" "installed" "current" "pinned"
  2. "test1" "0.0.1" "0.1" ""
  3. "test2" "0.0.2" "0.1" "0.0.2"
  4. "test3" "10.10.1_1" "11.0.1_1" ""

Convert to XML

Normal output:

  1. <?xml version='1.0' encoding='UTF-8'?><formulas><outdated><formula>test1</formula><installed>0.0.1</installed><current>0.1</current><pinned></pinned></outdated><outdated><formula>test2</formula><installed>0.0.2</installed><current>0.1</current><pinned>0.0.2</pinned></outdated><outdated><formula>test3</formula><installed>10.10.1_1</installed><current>11.0.1_1</current><pinned></pinned></outdated></formulas>

Pretty output:

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <formulas>
  3. <outdated>
  4. <formula>test1</formula>
  5. <installed>0.0.1</installed>
  6. <current>0.1</current>
  7. <pinned></pinned>
  8. </outdated>
  9. <outdated>
  10. <formula>test2</formula>
  11. <installed>0.0.2</installed>
  12. <current>0.1</current>
  13. <pinned>0.0.2</pinned>
  14. </outdated>
  15. <outdated>
  16. <formula>test3</formula>
  17. <installed>10.10.1_1</installed>
  18. <current>11.0.1_1</current>
  19. <pinned></pinned>
  20. </outdated>
  21. </formulas>

Convert to HTML

Normal output:

  1. <table><tr><th>formula</th><th>installed</th><th>current</th><th>pinned</th></tr><tr><td>test1</td><td>0.0.1</td><td>0.1</td><td></td></tr><tr><td>test2</td><td>0.0.2</td><td>0.1</td><td>0.0.2</td></tr><tr><td>test3</td><td>10.10.1_1</td><td>11.0.1_1</td><td></td></tr></table>

Pretty output:

  1. <table>
  2. <tr>
  3. <th>formula</th>
  4. <th>installed</th>
  5. <th>current</th>
  6. <th>pinned</th>
  7. </tr>
  8. <tr>
  9. <td>test1</td>
  10. <td>0.0.1</td>
  11. <td>0.1</td>
  12. <td></td>
  13. </tr>
  14. <tr>
  15. <td>test2</td>
  16. <td>0.0.2</td>
  17. <td>0.1</td>
  18. <td>0.0.2</td>
  19. </tr>
  20. <tr>
  21. <td>test3</td>
  22. <td>10.10.1_1</td>
  23. <td>11.0.1_1</td>
  24. <td></td>
  25. </tr>
  26. </table>

Supported Ruby Versions

  • Ruby 2.0.0
  • Ruby 2.1
  • Ruby 2.2
  • Ruby 2.3
  • Ruby 2.4
  • Ruby 2.5
  • Ruby 2.6

Contributing

Bug reports and pull requests are welcome.

License

MIT