Code Monkey home page Code Monkey logo

optimist's Introduction

optimist

http://manageiq.github.io/optimist/

Gem Version CI Code Climate Coverage Status

Documentation

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

require 'optimist'
opts = Optimist::options do
  opt :monkey, "Use monkey mode"                    # flag --monkey, default false
  opt :name, "Monkey name", :type => :string        # string --name <s>, default nil
  opt :num_limbs, "Number of limbs", :default => 4  # integer --num-limbs <i>, default to 4
end

p opts # a hash: { :monkey=>false, :name=>nil, :num_limbs=>4, :help=>false }

License

Copyright © 2008-2014 William Morgan.

Copyright © 2014 Red Hat, Inc.

Optimist is released under the MIT License.

optimist's People

Contributors

kbrock avatar fryguy avatar nanobowers avatar wmorgan avatar jojje avatar lutzky avatar petergoldstein avatar jrafanie avatar alezummo avatar ymaxkrapzv avatar chessbyte avatar okuramasafumi avatar nicklamuro avatar bdunne avatar agrare avatar mend-bolt-for-github[bot] avatar nathanzook avatar cprice404 avatar clxy avatar willf avatar tkareine avatar npras avatar orien avatar sigmike avatar mtasaka avatar xuhdev avatar eostrom avatar neontapir avatar chadmoore avatar aried3r avatar

Stargazers

Ernest Bursa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.