Code Monkey home page Code Monkey logo

trollop's Introduction

== trollop

by William Morgan (http://masanjin.net/)

Main page: http://trollop.rubyforge.org

Release announcements and comments: http://all-thing.net/label/trollop

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

== DESCRIPTION

Trollop 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, command
subcompletion, and sensible defaults for everything you don't specify.

== FEATURES/PROBLEMS

- Dirt-simple usage.
- Sensible defaults. No tweaking necessary, much tweaking possible.
- Support for long options, short options, short option bundling, and
  automatic type validation and conversion.
- Support for subcommands.
- Automatic help message generation, wrapped to current screen width.
- Lots of unit tests.

== REQUIREMENTS

* A burning desire to write less code.

== INSTALL

* gem install trollop

== SYNOPSIS

  require 'trollop'
  opts = Trollop::options do
    opt :monkey, "Use monkey mode"                     # flag --monkey, default false
    opt :goat, "Use goat mode", :default => true       # flag --goat, default true
    opt :num_limbs, "Number of limbs", :default => 4   # integer --num-limbs <i>, default to 4
    opt :num_thumbs, "Number of thumbs", :type => :int # integer --num-thumbs <i>, default nil
  end

  p opts # a hash: { :monkey => false, :goat => true, :num_limbs => 4, :num_thumbs => nil }

== LICENSE

Copyright (c) 2008--2009 William Morgan. Trollop is distributed under the same
terms as Ruby.

trollop's People

Contributors

lutzky avatar domon avatar eostrom avatar tkareine avatar willf avatar

Stargazers

Julien Ammous avatar

Watchers

James Cloos 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.