🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

parseopt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parseopt

0.3.2
Rubygems
Version published
Maintainers
1
Created
Source

A very simple option parser.

It uses as inspiration Git's internal option parser code, and Ruby's OptionParser.

require 'parseopt'

opts = ParseOpt.new('my command')

# only short
opts.on('b') do |v|
 $bool = v
end

# short and long
opts.on('s', 'string') do |v|
 $string = v
end

# short, long, and help
opts.on('n', 'number', 'Number') do |v|
 $number = v.to_i
end

opts.parse

Running with --help gives:

usage: my command
    -b
    -s, --string
    -n, --number          Number

Installation

Simply install the gem:

gem install parseopt

FAQs

Package last updated on 02 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts