https://github.com/ruby/optparse
OptionParser is a class for command-line option analysis.
https://github.com/ruby/optparse
Keywords
hacktoberfest ruby
Keywords from Contributors
repl rubygems bigdecimal debugger webrick debugging-tool strscan documentation-tool activerecord mvc
Last synced: about 2 hours ago
JSON representation
Repository metadata
OptionParser is a class for command-line option analysis.
- Host: GitHub
- URL: https://github.com/ruby/optparse
- Owner: ruby
- License: other
- Created: 2020-05-22T11:10:25.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2026-02-09T04:14:48.000Z (22 days ago)
- Last Synced: 2026-02-14T17:20:10.225Z (17 days ago)
- Topics: hacktoberfest, ruby
- Language: Ruby
- Homepage:
- Size: 585 KB
- Stars: 69
- Watchers: 35
- Forks: 27
- Open Issues: 7
- Releases: 11
-
Metadata Files:
- Readme: README.md
- License: COPYING
README.md
OptionParser
OptionParser is a class for command-line option analysis. It is much more
advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented
solution.
Features
- The argument specification and the code to handle it are written in the
same place. - It can output an option summary; you don't need to maintain this string
separately. - Optional and mandatory arguments are specified very gracefully.
- Arguments can be automatically converted to a specified class.
- Arguments can be restricted to a certain set.
Installation
Add this line to your application's Gemfile:
gem 'optparse'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install optparse
Usage
Full documentation is here.
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end.parse!
p options
p ARGV
Development
After checking out the repo, run bundle install to install dependencies. Then, run rake test to run the tests.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/optparse.
Owner metadata
- Name: The Ruby Programming Language
- Login: ruby
- Email: info@ruby-lang.org
- Kind: organization
- Description: Repositories related to the Ruby Programming language
- Website: https://www.ruby-lang.org/
- Location: Matsue, Japan
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/210414?v=4
- Repositories: 171
- Last ynced at: 2023-04-09T03:40:20.875Z
- Profile URL: https://github.com/ruby
GitHub Events
Total
- Release event: 3
- Delete event: 28
- Member event: 1
- Pull request event: 63
- Fork event: 3
- Issues event: 7
- Watch event: 11
- Issue comment event: 7
- Push event: 53
- Pull request review comment event: 1
- Pull request review event: 2
- Create event: 29
Last Year
- Release event: 1
- Delete event: 22
- Pull request event: 49
- Fork event: 1
- Issues event: 7
- Watch event: 8
- Issue comment event: 6
- Push event: 44
- Pull request review comment event: 1
- Pull request review event: 2
- Create event: 23
Committers metadata
Last synced: 3 days ago
Total Commits: 405
Total Committers: 41
Avg Commits per committer: 9.878
Development Distribution Score (DDS): 0.425
Commits in past year: 57
Committers in past year: 9
Avg Commits per committer in past year: 6.333
Development Distribution Score (DDS) in past year: 0.614
| Name | Commits | |
|---|---|---|
| nobu | n****u@b****e | 233 |
| Hiroshi SHIBATA | h****t@r****g | 43 |
| dependabot[bot] | 4****] | 27 |
| matz | m****z@b****e | 15 |
| Burdette Lamar | B****r@Y****m | 15 |
| kazu | k****u@b****e | 7 |
| zzak | z****k@b****e | 5 |
| akr | a****r@b****e | 5 |
| Yusuke Endoh | m****e@r****g | 4 |
| drbrain | d****n@b****e | 4 |
| Sam Westerman | s****m@s****e | 4 |
| Olle Jonsson | o****n@g****m | 4 |
| Jeremy Evans | c****e@j****t | 4 |
| ko1 | k****1@b****e | 3 |
| gsinclair | g****r@b****e | 2 |
| Takashi Kokubun | t****n@g****m | 2 |
| fatkodima | f****3@g****m | 2 |
| naruse | n****e@b****e | 2 |
| stomar | s****r@b****e | 2 |
| AJ Jordan | a****x@s****t | 1 |
| zverok | z****e@g****m | 1 |
| ydah | 1****h | 1 |
| usa | u****a@b****e | 1 |
| shugo | s****o@b****e | 1 |
| nagachika | n****a@b****e | 1 |
| kwatch | k****h@g****m | 1 |
| ktsj | k****j@b****e | 1 |
| konsolebox | k****x@g****m | 1 |
| a_matsuda | a****a@b****e | 1 |
| Whyme Lyu | 5****a@g****m | 1 |
| and 11 more... | ||
Committer domains:
- ruby-lang.org: 2
- riseup.net: 1
- sonicgarden.jp: 1
- ruby-dev.jp: 1
- shakenbu.org: 1
- mailbox.org: 1
- peterzhu.ca: 1
- strugee.net: 1
- jeremyevans.net: 1
- sampersand.me: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 18
Total pull requests: 129
Average time to close issues: 2 months
Average time to close pull requests: 14 days
Total issue authors: 15
Total pull request authors: 28
Average comments per issue: 0.94
Average comments per pull request: 0.52
Merged pull request: 111
Bot issues: 0
Bot pull requests: 31
Past year issues: 3
Past year pull requests: 39
Past year average time to close issues: 3 days
Past year average time to close pull requests: 6 days
Past year issue authors: 3
Past year pull request authors: 9
Past year average comments per issue: 1.33
Past year average comments per pull request: 0.08
Past year merged pull request: 31
Past year bot issues: 0
Past year bot pull requests: 15
Top Issue Authors
- kwatch (3)
- BurdetteLamar (2)
- bkuhlmann (1)
- s7pdragon (1)
- BrianLMatthews (1)
- postmodern (1)
- castor4bit (1)
- ETLJ (1)
- Earlopain (1)
- nobu (1)
- joshdholtz (1)
- JunichiIto (1)
- rafaelfranca (1)
- Watson1978 (1)
- TApplencourt (1)
Top Pull Request Authors
- dependabot[bot] (31)
- nobu (29)
- BurdetteLamar (17)
- hsbt (11)
- kwatch (4)
- olleolleolle (4)
- fatkodima (4)
- jeremyevans (3)
- sampersand (3)
- kyanagi (2)
- AlexWayfer (2)
- sw-square (2)
- k0kubun (2)
- edgibbs (1)
- toy (1)
Top Issue Labels
- documentation (1)
Top Pull Request Labels
- dependencies (31)
- documentation (16)
- github_actions (15)
- enhancement (2)
Package metadata
- Total packages: 2
-
Total downloads:
- rubygems: 194,457,466 total
- Total docker downloads: 6,597,230,518
- Total dependent packages: 48 (may contain duplicates)
- Total dependent repositories: 4,936 (may contain duplicates)
- Total versions: 22
- Total maintainers: 3
gem.coop: optparse
OptionParser is a class for command-line option analysis. It is much more advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented solution.
- Homepage: https://github.com/ruby/optparse
- Documentation: http://www.rubydoc.info/gems/optparse/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 0.8.1 (published 3 months ago)
- Last Synced: 2026-02-28T18:01:08.110Z (3 days ago)
- Versions: 11
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 97,361,251 Total
- Docker Downloads: 3,298,615,259
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.101%
- Downloads: 0.302%
- Maintainers (3)
rubygems.org: optparse
OptionParser is a class for command-line option analysis. It is much more advanced, yet also easier to use, than GetoptLong, and is a more Ruby-oriented solution.
- Homepage: https://github.com/ruby/optparse
- Documentation: http://www.rubydoc.info/gems/optparse/
- Licenses: Ruby,BSD-2-Clause
- Latest release: 0.8.1 (published 3 months ago)
- Last Synced: 2026-02-26T11:01:37.201Z (5 days ago)
- Versions: 11
- Dependent Packages: 48
- Dependent Repositories: 4,936
- Downloads: 97,096,215 Total
- Docker Downloads: 3,298,615,259
-
Rankings:
- Docker downloads count: 0.033%
- Dependent repos count: 0.451%
- Downloads: 0.525%
- Dependent packages count: 0.656%
- Average: 2.556%
- Forks count: 5.622%
- Stargazers count: 8.047%
- Maintainers (3)
Dependencies
- rake >= 0
- test-unit >= 0
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- ruby/setup-ruby v1 composite
- actions/upload-artifact v4 composite
- actions/checkout v5 composite
- github/codeql-action/analyze v4 composite
- github/codeql-action/autobuild v4 composite
- github/codeql-action/init v4 composite
- actions/checkout 08c6903cd8c0fde910a37f88322edcfb5dd907a8 composite
- ruby/setup-ruby d5126b9b3579e429dd52e51e68624dda2e05be25 composite
- rubygems/release-gem 1c162a739e8b4cb21a676e97b087e8268d8fc40b composite
- step-security/harden-runner 95d9a5deda9de15063e7595e9719c11c38c90ae2 composite
- actions/checkout v5 composite
- actions/create-github-app-token v2 composite
- convictional/trigger-workflow-and-wait v1.6.5 composite
Score: 30.683272032496536