micro-optparse 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d818c3f17d7145292be780c6a915949bffb67ff9
4
+ data.tar.gz: c95aeea5d5eb0985b17abe704f26419b0ba6283e
5
+ SHA512:
6
+ metadata.gz: ab7a238179cc66385bc1c3e02ff7da394f67d5cfda3e12d1c9b82cee9232bb06528d645d7dbe930cee6ef42509c036eac88650ad868cc79461652aeea34ee801
7
+ data.tar.gz: 0145bd617acdefce3a925999c96c736cae33dbb260a8c5f9e6c70579d8f5ee986ba4da9922b29294032224e2e1896753d4b85f83dfaccb9c00efc60724fba575
data/CHANGES.md ADDED
@@ -0,0 +1,20 @@
1
+ Version History
2
+ ===============
3
+
4
+ Version 1.2.0 (2013-12-29)
5
+ --------------------------
6
+
7
+ * Fixed bug which raised an error in ruby 2.0, when all chars for the short
8
+ accessor had already been used
9
+
10
+ * Added argument setting `:optional => true`, so argument will only appear in
11
+ the parsed option if given by the user, thus it will not be filled using
12
+ the default value
13
+
14
+ * Added argument setting `:no_short => true`, to prevent the creation of an
15
+ short accessor for the argument
16
+
17
+ * Added possibility to define default settings when creating the Parser,
18
+ for example to prevent creation of short accessors for ALL arguments easily
19
+
20
+ * Added some more tests and improved readability
data/README.md CHANGED
@@ -17,7 +17,7 @@ So µ-optparse is for you if you are looking for
17
17
  What is µ-optparse?
18
18
  -------------------
19
19
 
20
- µ-optparse is a small wrapper around [optparse](http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html), weighing **less than 75 lines of code**.
20
+ µ-optparse is a small wrapper around [optparse](http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html), weighing **less than 80 lines of code**.
21
21
  optparse (or OptionParser) on the other hand is a command line parser, which ships with ruby.
22
22
  After you defined available options, it automatically creates a help page and is able to parse ARGV accordingly.
23
23
  However, optparse requires you to repeat yourself quite often, which leads to many lines of code, just to configure the available options.
@@ -27,18 +27,21 @@ In addition, µ-optparse extends optparse by some **powerful validations**,
27
27
  Talk in code!
28
28
  -------------
29
29
 
30
- require 'rubygems' # necessary for ruby v1.8.*
31
- require 'micro-optparse'
32
- options = Parser.new do |p|
33
- p.banner = "This is a fancy script, for usage see below"
34
- p.version = "fancy script 0.0 alpha"
35
- p.option :severity, "set severity", :default => 4, :value_in_set => [4,5,6,7,8]
36
- p.option :verbose, "enable verbose output"
37
- p.option :mutation, "set mutation", :default => "MightyMutation", :value_matches => /Mutation/
38
- p.option :plus_selection, "use plus-selection if set", :default => true
39
- p.option :selection, "selection used", :default => "BestSelection", :short => "l"
40
- p.option :chance, "set mutation chance", :default => 0.8, :value_satisfies => lambda {|x| x >= 0.0 && x <= 1.0}
41
- end.process!
30
+ ```ruby
31
+ require 'rubygems' # necessary for ruby v1.8.*
32
+ require 'micro-optparse'
33
+
34
+ options = Parser.new do |p|
35
+ p.banner = "This is a fancy script, for usage see below"
36
+ p.version = "fancy script 0.0 alpha"
37
+ p.option :severity, "set severity", :default => 4, :value_in_set => [4,5,6,7,8]
38
+ p.option :verbose, "enable verbose output"
39
+ p.option :mutation, "set mutation", :default => "MightyMutation", :value_matches => /Mutation/
40
+ p.option :plus_selection, "use plus-selection if set", :default => true
41
+ p.option :selection, "selection used", :default => "BestSelection", :short => "l"
42
+ p.option :chance, "set mutation chance", :default => 0.8, :value_satisfies => lambda {|x| x >= 0.0 && x <= 1.0}
43
+ end.process!
44
+ ```
42
45
 
43
46
  What this piece of code does is the following:
44
47
 
@@ -65,6 +68,24 @@ The automatically generated help message looks like this:
65
68
  -h, --help Show this message
66
69
  -V, --version Print version
67
70
 
71
+ To show some example calls and results, I will use a simplified version of the Parser above:
72
+
73
+ ```ruby
74
+ require 'rubygems' # necessary for ruby v1.8.*
75
+ require 'micro-optparse'
76
+
77
+ options = Parser.new do |p|
78
+ p.option :severity, "set severity", :default => 4, :value_in_set => [4,5,6,7,8]
79
+ p.option :mutation, "set mutation", :default => "MightyMutation", :value_matches => /Mutation/
80
+ p.option :plus_selection, "use plus-selection if set", :default => true, :optional => true
81
+ end.process!
82
+ ```
83
+
84
+ * `ruby myprogram.rb --help` will yield a help message formatted like the one above
85
+ * `ruby myprogram.rb` will fill the variable `options` with the hash `{:severity => 4, :mutation => "MightyMutation"}` due to the given default values (`:plus_selection` does not appear in the result, due to the `:optional => true` setting, but can still be filled by the user)
86
+ * `ruby myprogram.rb -s 2 --mutation WeakMutation -p true` will fill the variable `options` with the hash `{:severity => 2, :mutation => "WeakMutation", :plus_selection => true}`, since the given values overwrite default values
87
+
88
+
68
89
  It doesn't stop at the command line!
69
90
  ------------------------------------
70
91
 
@@ -72,13 +93,15 @@ It doesn't stop at the command line!
72
93
  You can even process several arrays with the same parser (see example below).
73
94
  In addition, you don't need to specify all options at once, i.e. you can pass the parser around and add more options until you call the `process!`-method.
74
95
 
75
- require 'rubygems' # necessary for ruby v1.8.*
76
- require 'micro-optparse'
77
-
78
- parser = Parser.new
79
- parser.option :eat_snickers, "How many?", :default => 0
80
- options1 = parser.process!(["--eat-snickers", "2"])
81
- options2 = parser.process!(["--eat-snickers", "1"])
96
+ ```ruby
97
+ require 'rubygems' # necessary for ruby v1.8.*
98
+ require 'micro-optparse'
99
+
100
+ parser = Parser.new
101
+ parser.option :eat_snickers, "How many?", :default => 0
102
+ options1 = parser.process!(["--eat-snickers", "2"])
103
+ options2 = parser.process!(["--eat-snickers", "1"])
104
+ ```
82
105
 
83
106
  Where do I get &micro;-optparse?
84
107
  --------------------------
@@ -90,4 +113,107 @@ If you want to contribute, you can fork this repository, make your changes and s
90
113
  However, improvements must be one of the following:
91
114
 
92
115
  * use fewer lines of code, without sacrificing readablity or functionality
93
- * enhance readablity or functionality, without increasing the lines of code
116
+ * enhance readablity or functionality, without increasing the lines of code
117
+
118
+ Frequently Asked Questions
119
+ ==========================
120
+
121
+ All my argument values are either true or false - what's wrong?
122
+ ---------------------------------------------------------------
123
+ You must define default values, if the option should accept an argument. Every option without a default value (or with `true` or `false` as default) is treated as a switch: true if given and false / default otherwise.
124
+
125
+ Is it possible to define mandatory / required arguments, which must be provided?
126
+ --------------------------------------------------------------------------------
127
+ No it's not. Every option that has no default argument is a switch and if an option has a default argument, well there is a default to fall back to. However, what you can do is using &micro;-optparse to parse all options and switches (which are then removed from the ARGV array) and use everything that remains in ARGV as the mandatory arguments. Of course you have to raise an error yourself if no argument is left.
128
+
129
+ Consider the following example to implement mandatory arguments yourself:
130
+
131
+ ```ruby
132
+ require 'rubygems' # necessary for ruby v1.8.*
133
+ require 'micro-optparse'
134
+
135
+ options = Parser.new do |p|
136
+ p.option :meal, "Choose Meal", :default => "CucumberSalad"
137
+ end.parse!
138
+
139
+ raise ArgumentError, "No files given!" unless ARGV.size > 0
140
+ file = ARGV.shift
141
+ ```
142
+
143
+ If this short file is saved as `script.rb`, a call could look like the following: `ruby script.rb --meal=BrainSandwich file1.txt file2.txt`.
144
+
145
+ Are long arguments with spaces and other special characters allowed?
146
+ --------------------------------------------------------------------
147
+ Yes, just define an option which takes a `String` as an argument, i.e. pass a string as the default value for that option. Now everything between quotes will be parsed as the value for that argument, e.g. `ruby testscript.rb --selection 'I want the best selection you have!!! And if possible, add Donuts.'` Note that double quotes may cause trouble, for example I get an error if I use an exclamation mark in double quotes, but no error in single quotes.
148
+
149
+ Is it possible to define arguments which accept lists / arrays / multiple files / ... ?
150
+ ---------------------------------------------------------------------------------------
151
+ Yes, just define an option which takes an `Array` as an argument, i.e. pass an array as the default value for that option. The input will be split by comma. If the arguments contain spaces, wrap the whole thing in single quotes or double quotes.
152
+
153
+ For example if you want to accept multiple file names with whitespaces in them:
154
+
155
+ ```ruby
156
+ require 'rubygems' # necessary for ruby v1.8.*
157
+ require 'micro-optparse'
158
+
159
+ options = Parser.new do |p|
160
+ p.option :filenames, "Files which will be processed", :default => []
161
+ end.process!
162
+
163
+ p options[:filenames]
164
+ ```
165
+
166
+ `ruby testscript.rb --filenames 'todo.txt,my great adventures.txt'` yields `["todo.txt", "my great adventures.txt"]`.
167
+
168
+ Is it possible define an option without a default value?
169
+ --------------------------------------------------------
170
+
171
+ Yes and No. The literal answer to this question is "No", since a default value must be given for all arguments, except switches which default to `false`. However, what you are probably trying to achieve is to define an option which does only show up in the resulting hash, if the argument was given by the user. *This is actually possible!* Just add `:optional => true` to the line where you define your option and you are ready to go! The default value is still used for type checking.
172
+
173
+ ```ruby
174
+ require 'rubygems' # necessary for ruby v1.8.*
175
+ require 'micro-optparse'
176
+
177
+ options = Parser.new do |p|
178
+ p.option :file, "File to process (optional)", :default => "String", :optional => true
179
+ end.process!
180
+
181
+ puts options
182
+ ```
183
+
184
+ Example usage of this parser:
185
+
186
+ * `ruby myprogram.rb` will yield `{}`
187
+ * `ruby myprogram.rb --file testfile.txt` will yield `{:file => "testfile.txt"}`
188
+
189
+ Can I disable the short accessors?
190
+ ----------------------------------
191
+
192
+ Yes you can. To disable them globally, i.e. for all arguments of the parser, just create the Parser with the default setting `:no_short => true`. To disable the short accessor of just a few arguments, add `:no_short => true` as a setting to these arguments.
193
+
194
+ For example to disable short accessors for all arguments:
195
+
196
+ ```ruby
197
+ require 'rubygems' # necessary for ruby v1.8.*
198
+ require 'micro-optparse'
199
+
200
+ options = Parser.new(:no_short => true) do |p|
201
+ p.option :foo, "Foo"
202
+ end.process!
203
+
204
+ puts options
205
+ ```
206
+
207
+ To disable short accessor of just a few arguments:
208
+
209
+ ```ruby
210
+ require 'rubygems' # necessary for ruby v1.8.*
211
+ require 'micro-optparse'
212
+
213
+ options = Parser.new do |p|
214
+ p.option :foo, "Foo without short", :no_short => true
215
+ p.option :bar, "Bar with short"
216
+ end.process!
217
+
218
+ puts options
219
+ ```
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'bundler'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
+ include Rake::DSL
5
+
4
6
  Bundler::GemHelper.install_tasks
5
7
 
6
8
  RSpec::Core::RakeTask.new(:spec)
@@ -2,15 +2,17 @@ require 'optparse'
2
2
 
3
3
  class Parser
4
4
  attr_accessor :banner, :version
5
- def initialize
5
+ def initialize(default_settings = {})
6
6
  @options = []
7
7
  @used_short = []
8
- @default_values = nil
8
+ @default_values = {}
9
+ @default_settings = default_settings
9
10
  yield self if block_given?
10
11
  end
11
12
 
12
13
  def option(name, desc, settings = {})
13
- @options << [name, desc, settings]
14
+ settings = @default_settings.clone.merge(settings)
15
+ @options << {:name => name, :description => desc, :settings => settings}
14
16
  end
15
17
 
16
18
  def short_from(name)
@@ -18,45 +20,50 @@ class Parser
18
20
  next if @used_short.include?(c) || c == "_"
19
21
  return c # returns from short_from method
20
22
  end
23
+ return name.to_s.chars.first
21
24
  end
22
25
 
23
- def validate(options) # remove this method if you want fewer lines of code and don't need validations
24
- options.each_pair do |key, value|
25
- opt = @options.find_all{ |o| o[0] == key }.first
26
+ def validate(result) # remove this method if you want fewer lines of code and don't need validations
27
+ result.each_pair do |key, value|
28
+ o = @options.find_all{ |option| option[:name] == key }.first
26
29
  key = "--" << key.to_s.gsub("_", "-")
27
- unless opt[2][:value_in_set].nil? || opt[2][:value_in_set].include?(value)
28
- puts "Parameter for #{key} must be in [" << opt[2][:value_in_set].join(", ") << "]" ; exit(1)
30
+ unless o[:settings][:value_in_set].nil? || o[:settings][:value_in_set].include?(value)
31
+ puts "Parameter for #{key} must be in [" << o[:settings][:value_in_set].join(", ") << "]" ; exit(1)
29
32
  end
30
- unless opt[2][:value_matches].nil? || opt[2][:value_matches] =~ value
31
- puts "Parameter for #{key} must match /" << opt[2][:value_matches].source << "/" ; exit(1)
33
+ unless o[:settings][:value_matches].nil? || o[:settings][:value_matches] =~ value
34
+ puts "Parameter for #{key} must match /" << o[:settings][:value_matches].source << "/" ; exit(1)
32
35
  end
33
- unless opt[2][:value_satisfies].nil? || opt[2][:value_satisfies].call(value)
36
+ unless o[:settings][:value_satisfies].nil? || o[:settings][:value_satisfies].call(value)
34
37
  puts "Parameter for #{key} must satisfy given conditions (see description)" ; exit(1)
35
38
  end
36
39
  end
37
40
  end
38
41
 
39
42
  def process!(arguments = ARGV)
40
- @result = (@default_values || {}).clone # reset or new
43
+ @result = @default_values.clone # reset or new
41
44
  @optionparser ||= OptionParser.new do |p| # prepare only once
42
45
  @options.each do |o|
43
- @used_short << short = o[2][:short] || short_from(o[0])
44
- @result[o[0]] = o[2][:default] || false # set default
45
- klass = o[2][:default].class == Fixnum ? Integer : o[2][:default].class
46
+ @used_short << short = o[:settings][:no_short] ? nil : o[:settings][:short] || short_from(o[:name])
47
+ @result[o[:name]] = o[:settings][:default] || false unless o[:settings][:optional] # set default
48
+ name = o[:name].to_s.gsub("_", "-")
49
+ klass = o[:settings][:default].class == Fixnum ? Integer : o[:settings][:default].class
46
50
 
51
+ args = [o[:description]]
52
+ args << "-" + short if short
47
53
  if [TrueClass, FalseClass, NilClass].include?(klass) # boolean switch
48
- p.on("-" << short, "--[no-]" << o[0].to_s.gsub("_", "-"), o[1]) {|x| @result[o[0]] = x}
49
- else # argument with parameter
50
- p.on("-" << short, "--" << o[0].to_s.gsub("_", "-") << " " << o[2][:default].to_s, klass, o[1]) {|x| @result[o[0]] = x}
54
+ args << "--[no-]" + name
55
+ else # argument with parameter, add class for typecheck
56
+ args << "--" + name + " " + o[:settings][:default].to_s << klass
51
57
  end
58
+ p.on(*args) {|x| @result[o[:name]] = x}
52
59
  end
53
60
 
54
61
  p.banner = @banner unless @banner.nil?
55
62
  p.on_tail("-h", "--help", "Show this message") {puts p ; exit}
56
63
  short = @used_short.include?("v") ? "-V" : "-v"
57
64
  p.on_tail(short, "--version", "Print version") {puts @version ; exit} unless @version.nil?
58
- @default_values = @result.clone # save default values to reset @result in subsequent calls
59
65
  end
66
+ @default_values = @result.clone # save default values to reset @result in subsequent calls
60
67
 
61
68
  begin
62
69
  @optionparser.parse!(arguments)
@@ -67,4 +74,4 @@ class Parser
67
74
  validate(@result) if self.respond_to?("validate")
68
75
  @result
69
76
  end
70
- end
77
+ end
@@ -1,5 +1,5 @@
1
1
  module Micro
2
2
  module Optparse
3
- VERSION = "1.1.5"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Florian Pilz"]
10
10
  s.email = ["fpilz87@googlemail.com"]
11
11
  s.homepage = "http://florianpilz.github.com/micro-optparse/"
12
- s.summary = %q{An option parser which is 70 lines short.}
13
- s.description = %q{This option parser is 70 lines short and is based on OptionParser. It has strong validations and a short, clear and easy to use syntax. Feel free to copy all 70 lines (45 lines without validations / empty lines) into your script rather installing the gem.}
12
+ s.summary = %q{An lightweight option parser, which is 80 lines short.}
13
+ s.description = %q{This is an lightweight option parser, which is less than 80 lines short. It has strong validations and a short, clear and easy to use syntax. Feel free to copy all 80 lines (55 lines without validations / empty lines) into your script rather installing the gem.}
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/spec/parser_spec.rb CHANGED
@@ -27,6 +27,15 @@ describe Parser do
27
27
  result[:selection].should == "BestSelection"
28
28
  result[:chance].should == 0.8
29
29
  end
30
+
31
+ it "should not return a default value if the argument is declared optional" do
32
+ parser = Parser.new do |p|
33
+ p.option :optarg, "optional argument", :optional => true
34
+ end
35
+ result = parser.process!()
36
+ result.has_key?(:optarg).should == false
37
+ result[:optarg].should == nil
38
+ end
30
39
  end
31
40
 
32
41
  describe "setting of custom values" do
@@ -89,6 +98,52 @@ describe Parser do
89
98
  parser.class.should == Parser
90
99
  end
91
100
  end
101
+
102
+ describe "parsing of lists" do
103
+ it "should parse list of arguments separated by comma when given an array as default" do
104
+ parser = Parser.new do |p|
105
+ p.option :listarg, "List Argument", :default => []
106
+ end
107
+
108
+ input = ['--listarg', 'foo,bar,baz']
109
+ parser.process!(input)[:listarg].should == ['foo', 'bar', 'baz']
110
+ end
111
+
112
+ it "should allow multiple argument lists" do
113
+ parser = Parser.new do |p|
114
+ p.option :first_listarg, "List Argument", :default => []
115
+ p.option :second_listarg, "List Argument", :default => []
116
+ end
117
+
118
+ input = ['-f', 'foo,bar,baz', '-s', 'blah,blah,blah']
119
+ result = parser.process!(input)
120
+ result[:first_listarg].should == ['foo', 'bar', 'baz']
121
+ result[:second_listarg].should == ['blah', 'blah', 'blah']
122
+ end
123
+ end
124
+
125
+ describe "default settings" do
126
+ it "should set default settings on all options" do
127
+ parser = Parser.new(:optional => true) do |p|
128
+ p.option :foo, "foo argument"
129
+ p.option :bar, "bar argument"
130
+ end
131
+
132
+ result = parser.process!([])
133
+ result.length.should == 0 # all optional
134
+ end
135
+
136
+ it "should allow to overwrite default settings" do
137
+ parser = Parser.new(:default => "Bar") do |p|
138
+ p.option :foo, "foo argument", :default => "Foo"
139
+ p.option :bar, "bar argument"
140
+ end
141
+
142
+ result = parser.process!([])
143
+ result[:foo].should == "Foo"
144
+ result[:bar].should == "Bar"
145
+ end
146
+ end
92
147
 
93
148
  describe "help message" do
94
149
  it "should show help message when called with --help or -h" do
@@ -195,4 +250,27 @@ describe Parser do
195
250
  result.should include("-e, --eat-me")
196
251
  end
197
252
  end
253
+
254
+ describe "assigns short for every param" do
255
+ it "should use every short only once" do
256
+ result = `ruby spec/programs/short.rb --help`
257
+ result.scan(/\s-a/).length.should == 1
258
+ result.scan(/\s-b/).length.should == 1
259
+ result.scan(/\s-c/).length.should == 1
260
+ end
261
+
262
+ it "should use first char as short if all have been used" do
263
+ result = `ruby spec/programs/short.rb --help`
264
+ result.should include("-a, --acb")
265
+ result.should include("-b, --bac")
266
+ result.should include("-c, --cba")
267
+ end
268
+
269
+ it "should be possible to prevent creation of short arguments" do
270
+ result = `ruby spec/programs/noshort.rb --help`
271
+ result.should_not include("-f, --foo")
272
+ result.should include("--foo")
273
+ result.should include("-b, --bar")
274
+ end
275
+ end
198
276
  end
@@ -0,0 +1,11 @@
1
+ require "rubygems"
2
+ require "micro-optparse"
3
+
4
+ options = Parser.new do |p|
5
+ p.option :foo, "Option 1", :default => "String", :no_short => true
6
+ p.option :bar, "Option 2", :default => "String"
7
+ end.process!
8
+
9
+ options.each_pair do |key, value|
10
+ puts ":#{key} => #{value}"
11
+ end
@@ -0,0 +1,16 @@
1
+ require "rubygems"
2
+ require "micro-optparse"
3
+
4
+ options = Parser.new do |p|
5
+ p.option :abc, "Option 1", :default => "String"
6
+ p.option :bca, "Option 2", :default => "String"
7
+ p.option :cab, "Option 3", :default => "String"
8
+ # all shorts used up, futher shorts overwrite previous ones
9
+ p.option :bac, "Option 4", :default => "String"
10
+ p.option :acb, "Option 5", :default => "String"
11
+ p.option :cba, "Option 6", :default => "String"
12
+ end.process!
13
+
14
+ options.each_pair do |key, value|
15
+ puts ":#{key} => #{value}"
16
+ end
metadata CHANGED
@@ -1,48 +1,41 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: micro-optparse
3
- version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 5
10
- version: 1.1.5
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Florian Pilz
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-06-20 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2013-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :development
34
- version_requirements: *id001
35
- description: This option parser is 70 lines short and is based on OptionParser. It has strong validations and a short, clear and easy to use syntax. Feel free to copy all 70 lines (45 lines without validations / empty lines) into your script rather installing the gem.
36
- email:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: This is an lightweight option parser, which is less than 80 lines short.
28
+ It has strong validations and a short, clear and easy to use syntax. Feel free to
29
+ copy all 80 lines (55 lines without validations / empty lines) into your script
30
+ rather installing the gem.
31
+ email:
37
32
  - fpilz87@googlemail.com
38
33
  executables: []
39
-
40
34
  extensions: []
41
-
42
35
  extra_rdoc_files: []
43
-
44
- files:
36
+ files:
45
37
  - .gitignore
38
+ - CHANGES.md
46
39
  - Gemfile
47
40
  - MIT-LICENSE
48
41
  - README.md
@@ -54,43 +47,37 @@ files:
54
47
  - spec/parser_spec.rb
55
48
  - spec/programs/eating.rb
56
49
  - spec/programs/empty.rb
50
+ - spec/programs/noshort.rb
51
+ - spec/programs/short.rb
57
52
  - spec/programs/version.rb
58
- has_rdoc: true
59
53
  homepage: http://florianpilz.github.com/micro-optparse/
60
- licenses:
54
+ licenses:
61
55
  - MIT
56
+ metadata: {}
62
57
  post_install_message:
63
58
  rdoc_options: []
64
-
65
- require_paths:
59
+ require_paths:
66
60
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
- - 0
84
- version: "0"
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
85
71
  requirements: []
86
-
87
72
  rubyforge_project:
88
- rubygems_version: 1.4.2
73
+ rubygems_version: 2.0.14
89
74
  signing_key:
90
- specification_version: 3
91
- summary: An option parser which is 70 lines short.
92
- test_files:
75
+ specification_version: 4
76
+ summary: An lightweight option parser, which is 80 lines short.
77
+ test_files:
93
78
  - spec/parser_spec.rb
94
79
  - spec/programs/eating.rb
95
80
  - spec/programs/empty.rb
81
+ - spec/programs/noshort.rb
82
+ - spec/programs/short.rb
96
83
  - spec/programs/version.rb