{"id":13463060,"url":"https://github.com/JEG2/highline","last_synced_at":"2025-03-25T06:31:29.860Z","repository":{"id":493468,"uuid":"119955","full_name":"JEG2/highline","owner":"JEG2","description":"A higher level command-line oriented interface.","archived":false,"fork":false,"pushed_at":"2025-01-06T04:24:39.000Z","size":2314,"stargazers_count":1293,"open_issues_count":12,"forks_count":138,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-10T03:20:52.316Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/JEG2.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-02-02T16:25:53.000Z","updated_at":"2025-02-27T18:35:26.000Z","dependencies_parsed_at":"2024-01-13T03:01:03.703Z","dependency_job_id":"0be89f11-6c64-4d76-bd6b-9021f5daa2e5","html_url":"https://github.com/JEG2/highline","commit_stats":{"total_commits":1047,"total_committers":71,"mean_commits":"14.746478873239436","dds":"0.41356255969436484","last_synced_commit":"8c99b67dd3515c991029eb5135254a9f5aec34d6"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JEG2%2Fhighline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JEG2%2Fhighline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JEG2%2Fhighline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JEG2%2Fhighline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JEG2","download_url":"https://codeload.github.com/JEG2/highline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242799122,"owners_count":20186887,"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-07-31T13:00:45.251Z","updated_at":"2025-03-25T06:31:29.836Z","avatar_url":"https://github.com/JEG2.png","language":"Ruby","funding_links":[],"categories":["Developer Tools","Ruby"],"sub_categories":["CLI Option Parsers"],"readme":"HighLine\n========\n\n[![Tests](https://github.com/JEG2/highline/actions/workflows/ci.yml/badge.svg)](https://github.com/JEG2/highline/actions/workflows/ci.yml)\n[![Gem Version](https://badge.fury.io/rb/highline.svg)](https://badge.fury.io/rb/highline)\n[![Code Climate](https://codeclimate.com/github/JEG2/highline/badges/gpa.svg)](https://codeclimate.com/github/JEG2/highline)\n[![Test Coverage](https://codeclimate.com/github/JEG2/highline/badges/coverage.svg)](https://codeclimate.com/github/JEG2/highline/coverage)\n[![Inline docs](http://inch-ci.org/github/JEG2/highline.svg?branch=master)](http://inch-ci.org/github/JEG2/highline)\n\nDescription\n-----------\n\nWelcome to HighLine.\n\nHighLine was designed to ease the tedious tasks of doing console input and\noutput with low-level methods like ```gets``` and ```puts```. HighLine provides a\nrobust system for requesting data from a user, without needing to code all the\nerror checking and validation rules and without needing to convert the typed\nStrings into what your program really needs.  Just tell HighLine what you're\nafter, and let it do all the work.\n\nDocumentation\n-------------\n\nSee: [Rubydoc.info for HighLine](http://www.rubydoc.info/github/JEG2/highline/master).\nSpecially [HighLine](http://www.rubydoc.info/github/JEG2/highline/master/HighLine) and [HighLine::Question](http://www.rubydoc.info/github/JEG2/highline/master/HighLine/Question).\n\nUsage\n-----\n\n```ruby\n\nrequire 'highline'\n\n# Basic usage\n\ncli = HighLine.new\nanswer = cli.ask \"What do you think?\"\nputs \"You have answered: #{answer}\"\n\n\n# Default answer\n\ncli.ask(\"Company?  \") { |q| q.default = \"none\" }\n\n## Disable default value hint showing\n\nmy_special_default_object = Object.new\n\ncli.ask(\"Question?  \") do |q|\n  q.default = my_special_default_object\n  q.default_hint_show = false\nend\n\n\n# Validation\n\ncli.ask(\"Age?  \", Integer) { |q| q.in = 0..105 }\ncli.ask(\"Name?  (last, first)  \") { |q| q.validate = /\\A\\w+, ?\\w+\\Z/ }\n\n## Validation with custom class\nclass ZeroToTwentyFourValidator\n  def self.valid?(answer)\n    (0..24).include? answer.to_i\n  end\n\n  def self.inspect\n    \"(0..24) rule\"\n  end\nend\n\ncli.ask(\"What hour of the day is it?:  \", Integer) do |q|\n  q.validate = ZeroToTwentyFourValidator\nend\n\n## Validation with Dry::Types\n## `Dry::Types` provides a `valid?` method so it can be used effortlessly\n\nrequire 'dry-type'\n\nmodule Types\n  include Dry.Types\nend\n\ncli.ask(\"Type an integer:\", Integer) do |q|\n  q.validate = Types::Coercible::Integer\nend\n\n# Type conversion for answers:\n\ncli.ask(\"Birthday?  \", Date)\ncli.ask(\"Interests?  (comma sep list)  \", lambda { |str| str.split(/,\\s*/) })\n\n\n# Reading passwords:\n\ncli.ask(\"Enter your password:  \") { |q| q.echo = false }\ncli.ask(\"Enter your password:  \") { |q| q.echo = \"x\" }\n\n\n# ERb based output (with HighLine's ANSI color tools):\n\ncli.say(\"This should be \u003c%= color('bold', BOLD) %\u003e!\")\n\n\n# Menus:\n\ncli.choose do |menu|\n  menu.prompt = \"Please choose your favorite programming language?  \"\n  menu.choice(:ruby) { cli.say(\"Good choice!\") }\n  menu.choices(:python, :perl) { cli.say(\"Not from around here, are you?\") }\n  menu.default = :ruby\nend\n\n## Using colored indices on Menus\n\nHighLine::Menu.index_color   = :rgb_77bbff # set default index color\n\ncli.choose do |menu|\n  menu.index_color  = :rgb_999999      # override default color of index\n                                       # you can also use constants like :blue\n  menu.prompt = \"Please choose your favorite programming language?  \"\n  menu.choice(:ruby) { cli.say(\"Good choice!\") }\n  menu.choices(:python, :perl) { cli.say(\"Not from around here, are you?\") }\nend\n```\n\nIf you want to save some characters, you can inject/import HighLine methods on Kernel by doing the following. Just be sure to avoid name collisions in the top-level namespace.\n\n\n```ruby\nrequire 'highline/import'\n\nsay \"Now you can use #say directly\"\n```\n\nFor more examples see the examples/ directory of this project.\n\nRequirements\n------------\n\nHighLine from version \u003e= 3.0.0 requires ruby \u003e= 3.0.0\n\nInstalling\n----------\n\nTo install HighLine, use the following command:\n\n```sh\n$ gem install highline\n```\n\n(Add `sudo` if you're installing under a POSIX system as root)\n\nIf you're using [Bundler](http://bundler.io/), add this to your Gemfile:\n\n```ruby\nsource \"https://rubygems.org\"\ngem 'highline'\n```\n\nAnd then run:\n\n```sh\n$ bundle\n```\n\nIf you want to build the gem locally, use the following command from the root of the sources:\n\n```sh\n$ rake package\n```\n\nYou can also build and install directly:\n\n```sh\n$ rake install\n```\n\nContributing\n------------\n\n1. Open an issue\n  - https://github.com/JEG2/highline/issues\n\n2. Fork the repository\n  - https://github.com/JEG2/highline/fork\n\n3. Clone it locally\n  - ```git clone git@github.com:YOUR-USERNAME/highline.git```\n\n4. Add the main HighLine repository as the __upstream__ remote\n  - ```cd highline``` # to enter the cloned repository directory.\n  - ```git remote add upstream https://github.com/JEG2/highline```\n\n5. Keep your fork in sync with __upstream__\n  - ```git fetch upstream```\n  - ```git checkout master```\n  - ```git merge upstream/master```\n\n6. Create your feature branch\n  - ```git checkout -b your_branch```\n\n7. Hack the source code, run the tests and __pronto__\n  - ```rake test```\n  - ```rake acceptance```\n  - ```pronto run```\n\n  Alternatively, if you're in a [Docker](https://www.docker.com)ised environment,\n  don't care about installing anything locally -- just run `bin/test` instead.\n\n8. Commit your changes\n  - ```git commit -am \"Your commit message\"```\n\n9. Push it\n  - ```git push```\n\n10. Open a pull request\n  - https://github.com/JEG2/highline/pulls\n\nDetails on:\n\n* GitHub Guide to Contributing to Open Source - https://guides.github.com/activities/contributing-to-open-source/\n* GitHub issues - https://guides.github.com/features/issues/\n* Forking - https://help.github.com/articles/fork-a-repo/\n* Cloning - https://help.github.com/articles/cloning-a-repository/\n* Adding upstream - https://help.github.com/articles/configuring-a-remote-for-a-fork/\n* Syncing your fork - https://help.github.com/articles/syncing-a-fork/\n* Branching - https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging\n* Commiting - https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository\n* Pushing - https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes\n\nThe Core HighLine Team\n----------------------\n\n* [James Edward Gray II](https://github.com/JEG2) - Author\n* [Gregory Brown](https://github.com/practicingruby) - Core contributor\n* [Abinoam P. Marques Jr.](https://github.com/abinoam) - Core contributor\n\n_For a list of people who have contributed to the codebase, see [GitHub's list of contributors](https://github.com/JEG2/highline/contributors)._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJEG2%2Fhighline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJEG2%2Fhighline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJEG2%2Fhighline/lists"}