clip 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,21 @@
1
- === 0.0.1 / 2008-04-10
1
+ === 0.0.5 / 2008-06-12
2
2
 
3
- * Initial release for y'all to throw rotten veggies at.
3
+ * Removed sample_parser from bin (technomancy)
4
+ * fix a stupid bug causing an infinite loop for empty ARGV (technomancy)
5
+
6
+ === 0.0.4 / 2008-06-06
7
+
8
+ * Fixed typo in error message (thanks francois!)
9
+
10
+ === 0.0.3 / 2008-06-05
11
+
12
+ * Merged technomancy's patches for simple 1 LOC parsing -> hash
4
13
 
5
14
  === 0.0.2 / 2008-05-20
6
15
 
7
16
  * Cleaned up README
8
- * Added support for late-binding option processing with blocks
17
+ * Added support for late-binding option processing with blocks
18
+
19
+ === 0.0.1 / 2008-04-10
20
+
21
+ * Initial release for y'all to throw rotten veggies at.
@@ -13,7 +13,7 @@ def Clip(args=ARGV)
13
13
  end
14
14
 
15
15
  module Clip
16
- VERSION = "0.0.3"
16
+ VERSION = "0.0.5"
17
17
 
18
18
  ##
19
19
  # Indicates that the parser was incorrectly configured in the
@@ -160,7 +160,7 @@ module Clip
160
160
  option.process(self, value)
161
161
  end
162
162
  else
163
- @errors[param] = "Unrecoginzed parameter"
163
+ @errors[param] = "Unrecognized parameter"
164
164
  @valid = false
165
165
  next
166
166
  end
@@ -350,7 +350,7 @@ module Clip
350
350
  # # Clip.hash == { 'c' => 'config.yml', 'mode' => 'optimistic' }
351
351
  def self.hash(argv = ARGV.dup, values = [])
352
352
  @hash ||= begin
353
- argv.shift until argv.first =~ HASHER_REGEX
353
+ argv.shift until argv.first =~ HASHER_REGEX or argv.empty?
354
354
  while argv.first =~ HASHER_REGEX and argv.size >= 2 do
355
355
  values += [argv.shift.sub(/^--?/, ''), argv.shift]
356
356
  end
@@ -310,5 +310,9 @@ describe Clip do
310
310
  Clip.hash(['-c', 'config.yml', '--mode', 'optimistic']).
311
311
  should == { 'c' => 'config.yml', 'mode' => 'optimistic' }
312
312
  end
313
+
314
+ it "should return an empty hash for empty ARGV" do
315
+ Clip.hash([]).should == {}
316
+ end
313
317
  end
314
318
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Vollmer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-05 00:00:00 -07:00
12
+ date: 2008-06-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -24,8 +24,8 @@ dependencies:
24
24
  description: You like command-line parsing, but you hate all of the bloat. Why should you have to create a Hash, then create a parser, fill the Hash out then throw the parser away (unless you want to print out a usage message) and deal with a Hash? Why, for Pete's sake, should the parser and the parsed values be handled by two different objects?
25
25
  email:
26
26
  - alex.vollmer@gmail.com
27
- executables:
28
- - sample_parser
27
+ executables: []
28
+
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
@@ -34,7 +34,6 @@ extra_rdoc_files:
34
34
  files:
35
35
  - History.txt
36
36
  - README.txt
37
- - bin/sample_parser
38
37
  - lib/clip.rb
39
38
  - spec/clip_spec.rb
40
39
  has_rdoc: true
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.join(File.dirname(__FILE__), "../lib/clip")
4
-
5
- ##
6
- # This is a very simple example of how to use Clip
7
- p = Clip do |c|
8
- c.optional 's', 'server', :desc => 'The server name', :default => 'localhost'
9
- c.optional 'p', 'port', :desc => 'The port', :default => 8080 do |v|
10
- v.to_i
11
- end
12
- c.optional 'f', 'files', :desc => 'Files to upload', :multi => true
13
- c.flag 'v', 'verbose', :desc => 'Make it verbose, man'
14
- end
15
-
16
- printf("%10s %-20s\n", "attribute", "value")
17
- [:server, :port, :verbose?].each do |att|
18
- printf("%10s %-20s\n", att, p.send(att))
19
- end
20
- printf("%10s %-20s\n", "files", p.files.inspect)