Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ManageIQ/optimist
Optimist is a commandline option parser for Ruby that just gets out of your way.
https://github.com/ManageIQ/optimist
hacktoberfest
Last synced: about 1 month ago
JSON representation
Optimist is a commandline option parser for Ruby that just gets out of your way.
- Host: GitHub
- URL: https://github.com/ManageIQ/optimist
- Owner: ManageIQ
- License: mit
- Created: 2014-09-19T20:59:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-07-15T15:48:18.000Z (5 months ago)
- Last Synced: 2024-10-03T18:59:05.218Z (2 months ago)
- Topics: hacktoberfest
- Language: Ruby
- Homepage: https://manageiq.org/optimist/
- Size: 382 KB
- Stars: 248
- Watchers: 15
- Forks: 36
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-ruby - Optimist - A commandline option parser for Ruby that just gets out of your way. (CLI Builder)
README
# optimist
http://manageiq.github.io/optimist/
[![Gem Version](https://badge.fury.io/rb/optimist.svg)](http://badge.fury.io/rb/optimist)
[![CI](https://github.com/ManageIQ/optimist/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/optimist/actions/workflows/ci.yaml)
[![Code Climate](https://codeclimate.com/github/ManageIQ/optimist.svg)](https://codeclimate.com/github/ManageIQ/optimist)
[![Coverage Status](http://img.shields.io/coveralls/ManageIQ/optimist.svg)](https://coveralls.io/r/ManageIQ/optimist)## Documentation
- Quickstart: See `Optimist.options` and then `Optimist::Parser#opt`.
- Examples: http://manageiq.github.io/optimist/.
- Wiki: http://github.com/ManageIQ/optimist/wiki## Description
Optimist is a commandline option parser for Ruby that just gets out of your way.
One line of code per option is all you need to write. For that, you get a nice
automatically-generated help page, robust option parsing, and sensible defaults
for everything you don't specify.## Features
- Dirt-simple usage.
- Single file. Throw it in lib/ if you don't want to make it a Rubygem dependency.
- Sensible defaults. No tweaking necessary, much tweaking possible.
- Support for long options, short options, subcommands, and automatic type validation and
conversion.
- Automatic help message generation, wrapped to current screen width.## Requirements
* A burning desire to write less code.
## Install
* gem install optimist
## Synopsis
```ruby
require 'optimist'
opts = Optimist::options do
opt :monkey, "Use monkey mode" # flag --monkey, default false
opt :name, "Monkey name", :type => :string # string --name , default nil
opt :num_limbs, "Number of limbs", :default => 4 # integer --num-limbs , default to 4
endp opts # a hash: { :monkey=>false, :name=>nil, :num_limbs=>4, :help=>false }
```## License
Copyright © 2008-2014 [William Morgan](http://masanjin.net/).
Copyright © 2014 Red Hat, Inc.
Optimist is released under the [MIT License](http://www.opensource.org/licenses/MIT).