cmd-optparse.rb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cmd-optparse.rb.gemspec +1 -1
- data/lib/{optparse → cmd-optparse}/ac.rb +1 -1
- data/lib/{optparse → cmd-optparse}/date.rb +1 -1
- data/lib/{optparse → cmd-optparse}/kwargs.rb +2 -2
- data/lib/{optparse.rb → cmd-optparse/option_parser.rb} +16 -16
- data/lib/{optparse → cmd-optparse}/shellwords.rb +1 -1
- data/lib/{optparse → cmd-optparse}/time.rb +1 -1
- data/lib/{optparse → cmd-optparse}/uri.rb +1 -1
- data/lib/cmd-optparse.rb +1 -0
- data/test/optparse/test_optparse.rb +1 -1
- metadata +10 -10
- data/lib/optionparser.rb +0 -2
- /data/lib/{optparse → cmd-optparse}/version.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 604edf0badf7b3d053498dd0cdafaf516f31a0d6e300b444fc97a4c5a15e4fe1
|
4
|
+
data.tar.gz: efd52b19e71a60735369074178db092209e5b9a5944e1fce8e048002f8352d58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e8cbd03e9c2de55ac9bd17a5fe89a24b6a4602dd612cf45565b0d459a2ec5b17325727b3a008ed3d5c39e1d50642fb5343c7b869804e79008718c60b2fa3fa9
|
7
|
+
data.tar.gz: b94fe059e594aaa8808891a850682e1c5ab13e29284e2bd0886ab57409784735556b2f5ae1103c0caf7863fb1c37f1de6ea76b3d1d667521a165e450d5a082ae
|
data/cmd-optparse.rb.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require_relative '
|
2
|
+
require_relative 'option_parser'
|
3
3
|
|
4
4
|
class OptionParser
|
5
5
|
# :call-seq:
|
6
6
|
# define_by_keywords(options, method, **params)
|
7
7
|
#
|
8
|
-
# :include:
|
8
|
+
# :include: ../..option_parserreates_option.rdoc
|
9
9
|
#
|
10
10
|
def define_by_keywords(options, meth, **opts)
|
11
11
|
meth.parameters.each do |type, name|
|
@@ -73,7 +73,7 @@
|
|
73
73
|
#
|
74
74
|
# === Minimal example
|
75
75
|
#
|
76
|
-
# require 'optparse'
|
76
|
+
# require 'cmd-optparse'
|
77
77
|
#
|
78
78
|
# options = {}
|
79
79
|
# OptionParser.new do |parser|
|
@@ -92,7 +92,7 @@
|
|
92
92
|
# OptionParser can be used to automatically generate help for the commands you
|
93
93
|
# write:
|
94
94
|
#
|
95
|
-
# require 'optparse'
|
95
|
+
# require 'cmd-optparse'
|
96
96
|
#
|
97
97
|
# Options = Struct.new(:name)
|
98
98
|
#
|
@@ -130,7 +130,7 @@
|
|
130
130
|
# option name in all caps. If an option is used without the required argument,
|
131
131
|
# an exception will be raised.
|
132
132
|
#
|
133
|
-
# require 'optparse'
|
133
|
+
# require 'cmd-optparse'
|
134
134
|
#
|
135
135
|
# options = {}
|
136
136
|
# OptionParser.new do |parser|
|
@@ -183,8 +183,8 @@
|
|
183
183
|
# as a +Time+. If it succeeds, that time will be passed to the
|
184
184
|
# handler block. Otherwise, an exception will be raised.
|
185
185
|
#
|
186
|
-
# require 'optparse'
|
187
|
-
# require 'optparse/time'
|
186
|
+
# require 'cmd-optparse'
|
187
|
+
# require 'cmd-optparse/time'
|
188
188
|
# OptionParser.new do |parser|
|
189
189
|
# parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
|
190
190
|
# p time
|
@@ -206,7 +206,7 @@
|
|
206
206
|
# It specifies which conversion block to call whenever a class is specified.
|
207
207
|
# The example below uses it to fetch a +User+ object before the +on+ handler receives it.
|
208
208
|
#
|
209
|
-
# require 'optparse'
|
209
|
+
# require 'cmd-optparse'
|
210
210
|
#
|
211
211
|
# User = Struct.new(:id, :name)
|
212
212
|
#
|
@@ -242,7 +242,7 @@
|
|
242
242
|
#
|
243
243
|
# The +into+ option of +order+, +parse+ and so on methods stores command line options into a Hash.
|
244
244
|
#
|
245
|
-
# require 'optparse'
|
245
|
+
# require 'cmd-optparse'
|
246
246
|
#
|
247
247
|
# options = {}
|
248
248
|
# OptionParser.new do |parser|
|
@@ -268,8 +268,8 @@
|
|
268
268
|
# effect of specifying various options. This is probably the best way to learn
|
269
269
|
# the features of +optparse+.
|
270
270
|
#
|
271
|
-
# require 'optparse'
|
272
|
-
# require 'optparse/time'
|
271
|
+
# require 'cmd-optparse'
|
272
|
+
# require 'cmd-optparse/time'
|
273
273
|
# require 'ostruct'
|
274
274
|
# require 'pp'
|
275
275
|
#
|
@@ -1406,7 +1406,7 @@ XXX
|
|
1406
1406
|
# :call-seq:
|
1407
1407
|
# make_switch(params, block = nil)
|
1408
1408
|
#
|
1409
|
-
# :include: ../
|
1409
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1410
1410
|
#
|
1411
1411
|
def make_switch(opts, block = nil)
|
1412
1412
|
short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []
|
@@ -1544,7 +1544,7 @@ XXX
|
|
1544
1544
|
# :call-seq:
|
1545
1545
|
# define(*params, &block)
|
1546
1546
|
#
|
1547
|
-
# :include: ../
|
1547
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1548
1548
|
#
|
1549
1549
|
def define(*opts, &block)
|
1550
1550
|
top.append(*(sw = make_switch(opts, block)))
|
@@ -1554,7 +1554,7 @@ XXX
|
|
1554
1554
|
# :call-seq:
|
1555
1555
|
# on(*params, &block)
|
1556
1556
|
#
|
1557
|
-
# :include: ../
|
1557
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1558
1558
|
#
|
1559
1559
|
def on(*opts, &block)
|
1560
1560
|
define(*opts, &block)
|
@@ -1565,7 +1565,7 @@ XXX
|
|
1565
1565
|
# :call-seq:
|
1566
1566
|
# define_head(*params, &block)
|
1567
1567
|
#
|
1568
|
-
# :include: ../
|
1568
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1569
1569
|
#
|
1570
1570
|
def define_head(*opts, &block)
|
1571
1571
|
top.prepend(*(sw = make_switch(opts, block)))
|
@@ -1575,7 +1575,7 @@ XXX
|
|
1575
1575
|
# :call-seq:
|
1576
1576
|
# on_head(*params, &block)
|
1577
1577
|
#
|
1578
|
-
# :include: ../
|
1578
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1579
1579
|
#
|
1580
1580
|
# The new option is added at the head of the summary.
|
1581
1581
|
#
|
@@ -1588,7 +1588,7 @@ XXX
|
|
1588
1588
|
# :call-seq:
|
1589
1589
|
# define_tail(*params, &block)
|
1590
1590
|
#
|
1591
|
-
# :include: ../
|
1591
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1592
1592
|
#
|
1593
1593
|
def define_tail(*opts, &block)
|
1594
1594
|
base.append(*(sw = make_switch(opts, block)))
|
@@ -1599,7 +1599,7 @@ XXX
|
|
1599
1599
|
# :call-seq:
|
1600
1600
|
# on_tail(*params, &block)
|
1601
1601
|
#
|
1602
|
-
# :include: ../
|
1602
|
+
# :include: ../d/option_parserreates_option.rdoc
|
1603
1603
|
#
|
1604
1604
|
# The new option is added at the tail of the summary.
|
1605
1605
|
#
|
data/lib/cmd-optparse.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "cmd-optparse/option_parser"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmd-optparse.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
@@ -91,15 +91,15 @@ files:
|
|
91
91
|
- doc/optparse/ruby/true_class.rb
|
92
92
|
- doc/optparse/ruby/uri.rb
|
93
93
|
- doc/optparse/tutorial.rdoc
|
94
|
-
- lib/
|
95
|
-
- lib/optparse.rb
|
96
|
-
- lib/optparse/
|
97
|
-
- lib/optparse/
|
98
|
-
- lib/optparse/
|
99
|
-
- lib/optparse/shellwords.rb
|
100
|
-
- lib/optparse/time.rb
|
101
|
-
- lib/optparse/uri.rb
|
102
|
-
- lib/optparse/version.rb
|
94
|
+
- lib/cmd-optparse.rb
|
95
|
+
- lib/cmd-optparse/ac.rb
|
96
|
+
- lib/cmd-optparse/date.rb
|
97
|
+
- lib/cmd-optparse/kwargs.rb
|
98
|
+
- lib/cmd-optparse/option_parser.rb
|
99
|
+
- lib/cmd-optparse/shellwords.rb
|
100
|
+
- lib/cmd-optparse/time.rb
|
101
|
+
- lib/cmd-optparse/uri.rb
|
102
|
+
- lib/cmd-optparse/version.rb
|
103
103
|
- misc/rb_optparse.bash
|
104
104
|
- misc/rb_optparse.zsh
|
105
105
|
- rakelib/.document
|
data/lib/optionparser.rb
DELETED
File without changes
|