{"id":19816906,"url":"https://github.com/rvm/rvm2-ui","last_synced_at":"2025-05-01T10:33:19.726Z","repository":{"id":12280096,"uuid":"14904130","full_name":"rvm/rvm2-ui","owner":"rvm","description":"Abstract user interface handling in RVM2","archived":false,"fork":false,"pushed_at":"2015-05-17T17:54:21.000Z","size":304,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-26T23:09:52.762Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-03T19:53:33.000Z","updated_at":"2015-03-29T11:29:33.000Z","dependencies_parsed_at":"2022-08-21T05:10:36.779Z","dependency_job_id":null,"html_url":"https://github.com/rvm/rvm2-ui","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvm%2Frvm2-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvm%2Frvm2-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvm%2Frvm2-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvm%2Frvm2-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvm","download_url":"https://codeload.github.com/rvm/rvm2-ui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251860579,"owners_count":21655770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T10:11:01.005Z","updated_at":"2025-05-01T10:33:19.416Z","avatar_url":"https://github.com/rvm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rvm2::Ui\n\n[![Gem Version](https://badge.fury.io/rb/rvm2-ui.png)](http://rubygems.org/gems/rvm2-ui)\n[![Code Climate](https://codeclimate.com/github/rvm/rvm2-ui.png)](https://codeclimate.com/github/rvm/rvm2-ui)\n[![Coverage Status](https://coveralls.io/repos/rvm/rvm2-ui/badge.png?branch=master)](https://coveralls.io/r/rvm/rvm2-ui?branch=master)\n[![Build Status](https://travis-ci.org/rvm/rvm2-ui.png?branch=master)](https://travis-ci.org/rvm/rvm2-ui)\n[![Dependency Status](https://gemnasium.com/rvm/rvm2-ui.png)](https://gemnasium.com/rvm/rvm2-ui)\n[![Documentation](http://b.repl.ca/v1/yard-docs-blue.png)](http://rubydoc.info/gems/rvm2-ui/frames)\n\n## Example output\n\nUsing `:console` handler:\n\n    [ ] Command 1\n      Log output 1\n      [x] Command 2\n      [ ] Command 3\n        Log output 2\n      [v] Command 3\n    [v] Command 1\n\n## Installation\n\nGet the gem:\n\n    gem install rvm2-ui\n\nLoad it:\n\n    require 'rvm2/ui'\n\n## Usage\n\nDifferent handlers can be loaded using `pluginator` group `rvm2` type `ui/output`:\n\n    Rvm2::Ui.get(type = :console, rvm2_plugins = nil, *args)\n\nthe `args` will be passed to the handler constructor.\n\nTo get the default console output:\n\n    @ui = Rvm2::Ui.get\n\n## Wrapping code blocks\n\nThe `command` will produce checklist like item:\n\n   @ui.command('display name') do\n     do_something\n   end\n\nExample output with `:console` output - before finish:\n\n    [ ] Group 1\n\nafter finish:\n\n    [v] Group 1\n\n## Logging output\n\nThe `log` allows giving messages, warnings and errors to user:\n\n    log(message, type = :log)\nSupported types are `:log`, `:warn`, `:warn_important`, `:error`, any other type might be supported\nor should be handled as `:log` with the capitalized `type` as prefix.\n\nExample:\n\n    @ui.log(\"something went wrong\", :error)\n\nWould produce with console:\n\n    Error: something went wrong\n\n## Handling extra outputs\n\nIn some cases like running shell commands an `stdout` and `stderr` objects are available with `IO`\ninterface allowing proper output handling (not injecting text in random places):\n\n    @ui.command(\"test\") do\n      @ui.stderr.puts(\"debugging output\")\n    end\n\nwould produce with `:console`:\n\n    [ ] test\n      debugging output\n    [v] test\n\n## Combining multiple outputs\n\nIn some cases it might be useful to send the same output to different targets like UI and log:\n\n    Rvm2::UI.multi(rvm2_plugins)\n\nExample use:\n\n    @ui = Rvm2::UI.multi\n    @ui.add(:console)\n    @ui.add(:log, \"my_app.log\")\n    @ui.log(\"text\")\n    @ui.remove # removes the last added logger\n\nExample - temporarily use logger:\n\n    @ui = Rvm2::UI.multi\n    @ui.add(:console)\n    @ui.with(:log, \"my_app.log\") do\n      @ui.log(\"text\")\n    end\n\nIn both examples the output will be written to both standard output and log file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvm%2Frvm2-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvm%2Frvm2-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvm%2Frvm2-ui/lists"}