cmd-optparse.rb 0.1.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/cmd-optparse.rb.gemspec +3 -9
- data/lib/{optparse → cmd/option_parser}/ac.rb +0 -2
- data/lib/{optparse → cmd/option_parser}/date.rb +0 -2
- data/lib/{optparse → cmd/option_parser}/kwargs.rb +1 -2
- data/lib/{optparse → cmd/option_parser}/shellwords.rb +0 -3
- data/lib/{optparse → cmd/option_parser}/time.rb +0 -2
- data/lib/{optparse → cmd/option_parser}/uri.rb +0 -3
- data/lib/{optparse.rb → cmd/optparse.rb} +25 -17
- 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/option_parser}/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: 9cf82f634b0577123de20738385e9b15fbe0f62652ac8af58397d0226c928fdf
|
4
|
+
data.tar.gz: a4831214ac1b1534d13309826f186e2d34087a7613111901e276c056f055e38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9683268f5c6a7e983a85e6018672c2448f080cf61c425f04666e58f38fca9f05735043355e02aeefae8cc45e0f7bb201024b0f94448762f27853fcee9958b9a2
|
7
|
+
data.tar.gz: 4f117eae64d9fb5f18d38c7121dbc74dae9c565335ac0d520a10b690bcd421e0498846d052a0af2aa4049596cfdd14a6b7673bf11e7af35ce166a093ccf3375d
|
data/.gitignore
CHANGED
data/cmd-optparse.rb.gemspec
CHANGED
@@ -1,15 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
name = File.basename(__FILE__, ".gemspec")
|
4
|
-
version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
|
5
|
-
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
|
6
|
-
/^\s*OptionParser::Version\s*=\s*"(.*)"/ =~ line and break $1
|
7
|
-
end rescue nil
|
8
|
-
end
|
2
|
+
require "./lib/cmd-optparse"
|
9
3
|
|
10
4
|
Gem::Specification.new do |spec|
|
11
|
-
spec.name =
|
12
|
-
spec.version =
|
5
|
+
spec.name = File.basename(__FILE__, ".gemspec")
|
6
|
+
spec.version = OptionParser::VERSION
|
13
7
|
spec.authors = ["0x1eef", "Nobu Nakada"]
|
14
8
|
spec.email = ["0x1eef@protonmail.com"]
|
15
9
|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require_relative '../optparse'
|
3
2
|
|
4
3
|
class OptionParser
|
5
4
|
# :call-seq:
|
6
5
|
# define_by_keywords(options, method, **params)
|
7
6
|
#
|
8
|
-
# :include:
|
7
|
+
# :include: ../..option_parserreates_option.rdoc
|
9
8
|
#
|
10
9
|
def define_by_keywords(options, meth, **opts)
|
11
10
|
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
|
#
|
@@ -425,7 +425,7 @@
|
|
425
425
|
# If you have any questions, file a ticket at http://bugs.ruby-lang.org.
|
426
426
|
#
|
427
427
|
class OptionParser
|
428
|
-
|
428
|
+
VERSION = "0.5.0"
|
429
429
|
|
430
430
|
# :stopdoc:
|
431
431
|
NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
|
@@ -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
|
#
|
@@ -2337,6 +2337,14 @@ XXX
|
|
2337
2337
|
const_set(:OctalInteger, OptionParser::OctalInteger)
|
2338
2338
|
const_set(:DecimalNumeric, OptionParser::DecimalNumeric)
|
2339
2339
|
end
|
2340
|
+
|
2341
|
+
require_relative "option_parser/ac"
|
2342
|
+
require_relative "option_parser/date"
|
2343
|
+
require_relative "option_parser/time"
|
2344
|
+
require_relative "option_parser/kwargs"
|
2345
|
+
require_relative "option_parser/shellwords"
|
2346
|
+
require_relative "option_parser/uri"
|
2347
|
+
require_relative "option_parser/version"
|
2340
2348
|
end
|
2341
2349
|
|
2342
2350
|
# ARGV is arguable by OptionParser
|
data/lib/cmd-optparse.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "cmd/optparse"
|
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.
|
4
|
+
version: 0.5.0
|
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/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
102
|
-
- lib/optparse
|
94
|
+
- lib/cmd-optparse.rb
|
95
|
+
- lib/cmd/option_parser/ac.rb
|
96
|
+
- lib/cmd/option_parser/date.rb
|
97
|
+
- lib/cmd/option_parser/kwargs.rb
|
98
|
+
- lib/cmd/option_parser/shellwords.rb
|
99
|
+
- lib/cmd/option_parser/time.rb
|
100
|
+
- lib/cmd/option_parser/uri.rb
|
101
|
+
- lib/cmd/option_parser/version.rb
|
102
|
+
- lib/cmd/optparse.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
|