Popularity
3.4
Growing
Activity
4.9
-
244
16
36

Description

Documentation quickstart: See Trollop.options and then Trollop::Parser#opt. Also see the examples at http://manageiq.github.io/trollop/.

Code Quality Rank: L4
Monthly Downloads: 137,915
Programming language: Ruby
License: MIT License
Latest version: v3.0.1

Trollop alternatives and similar gems

Based on the "CLI Builder" category.
Alternatively, view Trollop alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Trollop or a related project?

Add another 'CLI Builder' Gem

README

optimist

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

Gem Version Build Status Code Climate Coverage Status Dependency 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.


*Note that all licence references and agreements mentioned in the Trollop README section above are relevant to that project's source code only.